package lily.phs.urh;

import java.text.SimpleDateFormat;
import java.util.Calendar;

import lily.phs.database.Constants;
import lily.phs.object.HereTipa;
import lily.phs.object.PersonInfo;
import lily.phs.object.PersonInfoLog;
import lily.phs.urh.R;
import lily.ui.control.MyPopupWindow;


import android.app.DatePickerDialog;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.os.Bundle;
import android.text.InputType;
import android.util.Log;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.View.OnFocusChangeListener;

import android.view.WindowManager.LayoutParams;
//import android.widget.CheckBox;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.DatePicker;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;

/**
 * 个人基本信息表（Page 1）
 * @author yuyanshan
 *
 */
public class person_info extends RelativeLayout implements OnClickListener,Constants, OnFocusChangeListener{
	View v;
//	Paint paint;
	private LinearLayout ll1;
	MyPopupWindow mPopupWindow;
	//private ScrollView sv;
	//CheckBox cb;
	private int n=0;
	private int k=0;
	private TextView tv;
	private Context myContext;
	private EditText et_pein_name,et_pein_id;
	private RadioGroup rg_pein_sex;
	private RadioButton rb_pein_unknowsex,rb_pein_boy,rb_pein_girl,rb_pein_untoldsex;
	private EditText et_pein_born;
	private EditText et_pein_perid;
	private EditText et_pein_work;
	private EditText et_pein_phone;
	private EditText et_pein_contact_name;
	private EditText et_pein_contact_phone;
//	private int pein_permatent_type;
	private RadioGroup rg_pein_permatent_type;
	private RadioButton rb_pein_register,rb_pein_unregister;
	private TextView tv_pein_nation;
	private RadioGroup rg_pein_nation;
	private RadioButton rb_pein_han,rb_pein_minority;
	private EditText et_pein_minority;
	private TextView tv_pein_blood_type;
	private RadioGroup rg_pein_blood_type;
	private RadioButton rb_pein_blood_Atype, rb_pein_blood_Btype, rb_pein_blood_Otype,
						rb_pein_blood_ABtype, rb_pein_blood_nonetype;
	private TextView tv_pein_rh_negative;
	private RadioGroup rg_pein_rh_negative;
	private RadioButton rb_pein_rh_negative_y,rb_pein_rh_negative_N,rb_pein_rh_negative_none;
	private TextView tv_pein_culture_stdd;
	private RadioGroup rg_pein_culture_stdd;
	private RadioButton rb_pein_illiteracy,rb_pein_grade,rb_pein_junior,rb_pein_senior,
						rb_pein_college,rb_pein_noneculture;
	private TextView tv_pein_occupation;
	private RadioGroup rg_pein_occupation;
	private RadioButton rb_pein_state_organs,rb_pein_worker,rb_pein_vawirrmqyyoy,
						rb_pein_commercial,rb_pein_farmer,rb_pein_production,rb_pein_soldier,
						rb_pein_occ_other;
	private TextView tv_pein_marriage;
	private RadioGroup rg_pein_marriage;
	private RadioButton rb_pein_unmarriage,rb_pein_marriaged,rb_pein_sanghun,rb_pein_divorce,rb_pein_none_marriage;
	private TextView tv_pein_hos_cost_type;
	private CheckBox cb_pein_city_worker,cb_pein_country_resident,cb_pein_newvillage,cb_pein_poor,
					 cb_pein_trade_hos_insurance,
					 cb_pein_allpubexpense,cb_pein_allpriexpense,cb_pein_hos_cost_other;
	private EditText et_pein_hos_cost_other;
	private TextView tv_pein_drug_allergy;
	private CheckBox cb_pein_drug_none,cb_pein_drug_penicillin,cb_pein_drug_sulfanilamide,
					 cb_pein_drug_streptomycin,cb_pein_drug_other;
	private EditText et_pein_drug_other;
	private TextView tv_pein_exposure_his;
	private CheckBox cb_pein_exposure_his_none,cb_pein_exposure_his_chemistry,
					 cb_pein_exposure_his_poison,cb_pein_exposure_his_radial;
	private TextView tv_pein_disease;
	private CheckBox cb_pein_disease_none,cb_pein_disease_hypertension,cb_pein_disease_diabetesmellitus,
					 cb_pein_disease_coronary,cb_pein_disease_cancer,cb_pein_disease_lung,cb_pein_disease_stroke,
					 cb_pein_disease_mental,cb_pein_disease_tuberculosis,
					 cb_pein_disease_hepatitis,cb_pein_disease_othercontagion,cb_pein_disease_occ,cb_pein_disease_other;
	private EditText et_pein_disease_cancer;
	private EditText et_pein_disease_occ;	
	private EditText et_pein_disease_other;
	private TextView tv_pein_disease_date1;
	private EditText et_pein_disease_year1;
	private EditText et_pein_disease_month1;
	private TextView tv_pein_disease_date2;
	private EditText et_pein_disease_year2;
	private EditText et_pein_disease_month2;
	private TextView tv_pein_disease_date3;
	private EditText et_pein_disease_year3;
	private EditText et_pein_disease_month3;
	private TextView tv_pein_disease_date4;
	private EditText et_pein_disease_year4;
	private EditText et_pein_disease_month4;
	private EditText et_pein_disease_year5;
	private TextView tv_pein_disease_date5;
	private EditText et_pein_disease_month5;
	private TextView tv_pein_disease_date6;
	private EditText et_pein_disease_year6;
	private EditText et_pein_disease_month6;
	private TextView tv_pein_surgery;
	private RadioGroup rg_pein_surgery;
	private RadioButton rb_pein_nonesurgery,rb_pein_surgery;
	private EditText et_pein_surgery_name1;
	private EditText et_pein_surgery_time1;
	private EditText et_pein_surgery_name2;
	private EditText et_pein_surgery_time2;
	private TextView tv_pein_trauma;
	private RadioGroup rg_pein_trauma;
	private RadioButton rb_pein_nonetrauma,rb_pein_trauma;
	private EditText et_pein_trauma_name1;
	private EditText et_pein_trauma_time1;
	private EditText et_pein_trauma_name2;
	private EditText et_pein_trauma_time2;
	private TextView tv_pein_transfusion;
	private RadioGroup rg_pein_transfusion;
	private RadioButton rb_pein_nonetransfusion,rb_pein_transfusion_reason;
	private EditText et_pein_transfusion_reason1;
	private EditText et_pein_transfusion_time1;
	private EditText et_pein_transfusion_reason2;
	private EditText et_pein_transfusion_time2;

	private int profileid=0;
	private String name = "";//姓名
	private String id = "";//编号
	private int gender = -1;
	private int age = -1;
	private int marriage = -1;
	private boolean hasHT = false;//是都患有高血压
	private boolean hasDiabet = false;//是都患有糖尿病
	private boolean hasMentalIll = false;//是都患有精神病
	
	private boolean isOccupationSet = false;
	
	private HereTipa ht;
	private PersonInfo pi,person;
	
	public  person_info(Context context){
		super(context);
		myContext=context;
	    //新建时无档案编号
		LayoutInflater factory = LayoutInflater.from(myContext);
		v=factory.inflate(R.layout.person_info, null);
		   
	}
		
	public  person_info(Context context,int pro){
	   super(context);
	   myContext=context;
       //档案编号
       this.profileid=pro;
	 
       LayoutInflater factory = LayoutInflater.from(myContext);
	   v=factory.inflate(R.layout.person_info, null);
   	}
	
	public int getProfileid() {
		return profileid;
	}

	public void setProfileid(int profileid) {
		this.profileid = profileid;
	}

	public void findWeidget(){
	       
		ll1=(LinearLayout)v.findViewById(R.id.fam_eco_hushuxing);
	       tv=(TextView)v.findViewById(R.id.widget31);
	       //sv=(ScrollView)v.findViewById(R.id.ScrollView01);
	       et_pein_name=(EditText)v.findViewById(R.id.et_pein_name);
	       et_pein_name.setInputType(InputType.TYPE_NULL);
	       et_pein_id=(EditText)v.findViewById(R.id.et_pein_id);
	       et_pein_id.setInputType(InputType.TYPE_NULL);
	       rg_pein_sex = (RadioGroup)v.findViewById(R.id.rg_pein_sex);
	       rb_pein_unknowsex = (RadioButton)v.findViewById(R.id.rb_pein_unknowsex);
	       rb_pein_boy = (RadioButton)v.findViewById(R.id.rb_pein_boy); 
	       rb_pein_girl = (RadioButton)v.findViewById(R.id.rb_pein_girl); 
	       rb_pein_untoldsex = (RadioButton)v.findViewById(R.id.rb_pein_untoldsex);
	       et_pein_born=(EditText)v.findViewById(R.id.et_pein_born);
	       et_pein_born.setInputType(InputType.TYPE_NULL);
	       et_pein_born.setOnClickListener(this);
	       et_pein_born.setOnFocusChangeListener(this);
	       
	       
	       
	       
	       et_pein_perid=(EditText)v.findViewById(R.id.et_pein_perid);
	       et_pein_work=(EditText)v.findViewById(R.id.et_pein_work);
	       et_pein_phone=(EditText)v.findViewById(R.id.et_pein_phone);
	       et_pein_contact_name=(EditText)v.findViewById(R.id.et_pein_contact_name);
	       et_pein_contact_phone=(EditText)v.findViewById(R.id.et_pein_contact_phone);
	       rg_pein_permatent_type = (RadioGroup)v.findViewById(R.id.rg_pein_permatent_type);
	       rb_pein_register=(RadioButton)v.findViewById(R.id.rb_pein_register);
	       rb_pein_unregister=(RadioButton)v.findViewById(R.id.rb_pein_unregister);
	       tv_pein_nation=(TextView)v.findViewById(R.id.tv_pein_nation);
	       
	       rg_pein_nation=(RadioGroup)v.findViewById(R.id.rg_pein_nation);
	       rb_pein_han=(RadioButton)v.findViewById(R.id.rb_pein_han);
	       rb_pein_han.setOnClickListener(this);
	       rb_pein_minority=(RadioButton)v.findViewById(R.id.rb_pein_minority);
	       rb_pein_minority.setOnClickListener(this);
	       et_pein_minority=(EditText)v.findViewById(R.id.et_pein_minority);
	       tv_pein_blood_type=(TextView)v.findViewById(R.id.tv_pein_blood_type);
	       rg_pein_blood_type=(RadioGroup)v.findViewById(R.id.rg_pein_blood_type);
	       rb_pein_blood_Atype=(RadioButton)v.findViewById(R.id.rb_pein_blood_Atype);
	       rb_pein_blood_Btype=(RadioButton)v.findViewById(R.id.rb_pein_blood_Btype);
	       rb_pein_blood_Otype=(RadioButton)v.findViewById(R.id.rb_pein_blood_Otype);
			rb_pein_blood_ABtype=(RadioButton)v.findViewById(R.id.rb_pein_blood_ABtype);
			rb_pein_blood_nonetype=(RadioButton)v.findViewById(R.id.rb_pein_blood_nonetype);
			tv_pein_rh_negative=(TextView)v.findViewById(R.id.tv_pein_rh_negative);
			rg_pein_rh_negative=(RadioGroup)v.findViewById(R.id.rg_pein_rh_negative);
			rb_pein_rh_negative_y=(RadioButton)v.findViewById(R.id.rb_pein_rh_negative_y);
			rb_pein_rh_negative_N=(RadioButton)v.findViewById(R.id.rb_pein_rh_negative_N);
			rb_pein_rh_negative_none=(RadioButton)v.findViewById(R.id.rb_pein_rh_negative_none);
			tv_pein_culture_stdd=(TextView)v.findViewById(R.id.tv_pein_culture_stdd);
			rg_pein_culture_stdd=(RadioGroup)v.findViewById(R.id.rg_pein_culture_stdd);
			rb_pein_illiteracy=(RadioButton)v.findViewById(R.id.rb_pein_illiteracy);
			rb_pein_grade=(RadioButton)v.findViewById(R.id.rb_pein_grade);
			rb_pein_junior=(RadioButton)v.findViewById(R.id.rb_pein_junior);
			rb_pein_senior=(RadioButton)v.findViewById(R.id.rb_pein_senior);
			rb_pein_college=(RadioButton)v.findViewById(R.id.rb_pein_college);
			rb_pein_noneculture=(RadioButton)v.findViewById(R.id.rb_pein_noneculture);
			tv_pein_occupation=(TextView)v.findViewById(R.id.tv_pein_occupation);
			rg_pein_occupation=(RadioGroup)v.findViewById(R.id.rg_pein_occupation);
			rb_pein_state_organs=(RadioButton)v.findViewById(R.id.rb_pein_state_organs);
			rb_pein_worker=(RadioButton)v.findViewById(R.id.rb_pein_worker);
			rb_pein_vawirrmqyyoy=(RadioButton)v.findViewById(R.id.rb_pein_vawirrmqyyoy);
			rb_pein_commercial=(RadioButton)v.findViewById(R.id.rb_pein_commercial);
			rb_pein_farmer=(RadioButton)v.findViewById(R.id.rb_pein_farmer);
			rb_pein_production=(RadioButton)v.findViewById(R.id.rb_pein_production);
			rb_pein_soldier=(RadioButton)v.findViewById(R.id.rb_pein_soldier);
			rb_pein_occ_other=(RadioButton)v.findViewById(R.id.rb_pein_occ_other);
			rb_pein_state_organs.setOnClickListener(this);
			rb_pein_worker.setOnClickListener(this);
			rb_pein_vawirrmqyyoy.setOnClickListener(this);
			rb_pein_commercial.setOnClickListener(this);
			rb_pein_farmer.setOnClickListener(this);
			rb_pein_production.setOnClickListener(this);
			rb_pein_soldier.setOnClickListener(this);
			rb_pein_occ_other.setOnClickListener(this);
			tv_pein_marriage=(TextView)v.findViewById(R.id.tv_pein_marriage);
			rg_pein_marriage=(RadioGroup)v.findViewById(R.id.rg_pein_marriage);
			rb_pein_unmarriage=(RadioButton)v.findViewById(R.id.rb_pein_unmarriage);
			rb_pein_marriaged=(RadioButton)v.findViewById(R.id.rb_pein_marriaged);
			rb_pein_sanghun=(RadioButton)v.findViewById(R.id.rb_pein_sanghun);
			rb_pein_divorce=(RadioButton)v.findViewById(R.id.rb_pein_divorce);
			rb_pein_none_marriage=(RadioButton)v.findViewById(R.id.rb_pein_none_marriage);
		/////////////////////////////////////////////	
			tv_pein_hos_cost_type=(TextView)v.findViewById(R.id.tv_pein_hos_cost_type);
			cb_pein_city_worker=(CheckBox)v.findViewById(R.id.cb_pein_city_worker);
			cb_pein_country_resident=(CheckBox)v.findViewById(R.id.cb_pein_country_resident);
			cb_pein_newvillage=(CheckBox)v.findViewById(R.id.cb_pein_newvillage);
			cb_pein_poor=(CheckBox)v.findViewById(R.id.cb_pein_poor);
			cb_pein_trade_hos_insurance=(CheckBox)v.findViewById(R.id.cb_pein_trade_hos_insurance);
			cb_pein_allpubexpense=(CheckBox)v.findViewById(R.id.cb_pein_allpubexpense);
			cb_pein_allpriexpense=(CheckBox)v.findViewById(R.id.cb_pein_allpriexpense);
			cb_pein_hos_cost_other=(CheckBox)v.findViewById(R.id.cb_pein_hos_cost_other);
			cb_pein_city_worker.setOnClickListener(this);
			cb_pein_country_resident.setOnClickListener(this);
			cb_pein_newvillage.setOnClickListener(this);
			cb_pein_poor.setOnClickListener(this);
			cb_pein_trade_hos_insurance.setOnClickListener(this);
			cb_pein_allpubexpense.setOnClickListener(this);
			cb_pein_allpriexpense.setOnClickListener(this);
			cb_pein_hos_cost_other.setOnClickListener(this);
		//	et_pein_hos_cost_other.setEnabled(false);
			et_pein_hos_cost_other=(EditText)v.findViewById(R.id.et_pein_hos_cost_other);
			tv_pein_drug_allergy=(TextView)v.findViewById(R.id.tv_pein_drug_allergy);
			cb_pein_drug_none=(CheckBox)v.findViewById(R.id.cb_pein_drug_none);
			cb_pein_drug_penicillin=(CheckBox)v.findViewById(R.id.cb_pein_drug_penicillin);
			cb_pein_drug_sulfanilamide=(CheckBox)v.findViewById(R.id.cb_pein_drug_sulfanilamide);
			cb_pein_drug_streptomycin=(CheckBox)v.findViewById(R.id.cb_pein_drug_streptomycin);
			cb_pein_drug_other=(CheckBox)v.findViewById(R.id.cb_pein_drug_other);
			cb_pein_drug_none.setOnClickListener(this);
			cb_pein_drug_penicillin.setOnClickListener(this);
			cb_pein_drug_sulfanilamide.setOnClickListener(this);
			cb_pein_drug_streptomycin.setOnClickListener(this);
			cb_pein_drug_other.setOnClickListener(this);
			et_pein_drug_other=(EditText)v.findViewById(R.id.et_pein_drug_other);
			tv_pein_exposure_his=(TextView)v.findViewById(R.id.tv_pein_exposure_his);
			cb_pein_exposure_his_none=(CheckBox)v.findViewById(R.id.cb_pein_exposure_his_none);
			cb_pein_exposure_his_chemistry=(CheckBox)v.findViewById(R.id.cb_pein_exposure_his_chemistry);
			cb_pein_exposure_his_poison=(CheckBox)v.findViewById(R.id.cb_pein_exposure_his_poison);
			cb_pein_exposure_his_radial=(CheckBox)v.findViewById(R.id.cb_pein_exposure_his_radial);
			cb_pein_exposure_his_none.setOnClickListener(this);
			cb_pein_exposure_his_chemistry.setOnClickListener(this);
			cb_pein_exposure_his_poison.setOnClickListener(this);
			cb_pein_exposure_his_radial.setOnClickListener(this);
			tv_pein_disease=(TextView)v.findViewById(R.id.tv_pein_disease);
			cb_pein_disease_none=(CheckBox)v.findViewById(R.id.cb_pein_disease_none);
			cb_pein_disease_hypertension=(CheckBox)v.findViewById(R.id.cb_pein_disease_hypertension);
			cb_pein_disease_diabetesmellitus=(CheckBox)v.findViewById(R.id.cb_pein_disease_diabetesmellitus);
			cb_pein_disease_coronary=(CheckBox)v.findViewById(R.id.cb_pein_disease_coronary);
		    cb_pein_disease_cancer=(CheckBox)v.findViewById(R.id.cb_pein_disease_cancer);
		    cb_pein_disease_lung=(CheckBox)v.findViewById(R.id.cb_pein_disease_lung);
		    cb_pein_disease_stroke=(CheckBox)v.findViewById(R.id.cb_pein_disease_stroke);
			cb_pein_disease_mental=(CheckBox)v.findViewById(R.id.cb_pein_disease_mental);
			cb_pein_disease_tuberculosis=(CheckBox)v.findViewById(R.id.cb_pein_disease_tuberculosis);
			cb_pein_disease_hepatitis=(CheckBox)v.findViewById(R.id.cb_pein_disease_hepatitis);
			cb_pein_disease_othercontagion=(CheckBox)v.findViewById(R.id.cb_pein_disease_othercontagion);
			cb_pein_disease_occ=(CheckBox)v.findViewById(R.id.cb_pein_disease_occ);
			cb_pein_disease_other=(CheckBox)v.findViewById(R.id.cb_pein_disease_other);
			cb_pein_disease_none.setOnClickListener(this);
		
			cb_pein_disease_hypertension.setOnClickListener(this);
			cb_pein_disease_diabetesmellitus.setOnClickListener(this);
			cb_pein_disease_coronary.setOnClickListener(this);
			cb_pein_disease_cancer.setOnClickListener(this);
			cb_pein_disease_lung.setOnClickListener(this);
			cb_pein_disease_stroke.setOnClickListener(this);
			cb_pein_disease_mental.setOnClickListener(this);
			cb_pein_disease_tuberculosis.setOnClickListener(this);
			cb_pein_disease_hepatitis.setOnClickListener(this);
			cb_pein_disease_othercontagion.setOnClickListener(this);
			cb_pein_disease_occ.setOnClickListener(this);
			cb_pein_disease_other.setOnClickListener(this);            
			
			et_pein_disease_cancer=(EditText)v.findViewById(R.id.et_pein_disease_cancer);
			et_pein_disease_occ=(EditText)v.findViewById(R.id.et_pein_disease_occ);
			et_pein_disease_other=(EditText)v.findViewById(R.id.et_pein_disease_other);
			tv_pein_disease_date1=(TextView)v.findViewById(R.id.tv_pein_disease_date1);
			et_pein_disease_year1=(EditText)v.findViewById(R.id.et_pein_disease_year1);
		//	et_pein_disease_year1.setInputType(InputType.TYPE_NULL);
		//	et_pein_disease_year1.setOnClickListener(this);
			et_pein_disease_month1=(EditText)v.findViewById(R.id.et_pein_disease_month1);
			tv_pein_disease_date2=(TextView)v.findViewById(R.id.tv_pein_disease_date2);
			et_pein_disease_year2=(EditText)v.findViewById(R.id.et_pein_disease_year2);
			et_pein_disease_month2=(EditText)v.findViewById(R.id.et_pein_disease_month2);
			tv_pein_disease_date3=(TextView)v.findViewById(R.id.tv_pein_disease_date3);
			et_pein_disease_year3=(EditText)v.findViewById(R.id.et_pein_disease_year3);
			et_pein_disease_month3=(EditText)v.findViewById(R.id.et_pein_disease_month3);
			tv_pein_disease_date4=(TextView)v.findViewById(R.id.tv_pein_disease_date4);
			et_pein_disease_year4=(EditText)v.findViewById(R.id.et_pein_disease_year4);
			et_pein_disease_month4=(EditText)v.findViewById(R.id.et_pein_disease_month4);
			tv_pein_disease_date5=(TextView)v.findViewById(R.id.tv_pein_disease_date5);
			et_pein_disease_year5=(EditText)v.findViewById(R.id.et_pein_disease_year5);
			et_pein_disease_month5=(EditText)v.findViewById(R.id.et_pein_disease_month5);
			tv_pein_disease_date6=(TextView)v.findViewById(R.id.tv_pein_disease_date6);
			et_pein_disease_year6=(EditText)v.findViewById(R.id.et_pein_disease_year6);
			et_pein_disease_month6=(EditText)v.findViewById(R.id.et_pein_disease_month6);
			
			tv_pein_surgery=(TextView)v.findViewById(R.id.tv_pein_surgery);
			rg_pein_surgery=(RadioGroup)v.findViewById(R.id.rg_pein_surgery);
			rb_pein_nonesurgery=(RadioButton)v.findViewById(R.id.rb_pein_nonesurgery);
			rb_pein_nonesurgery.setOnClickListener(this);
			rb_pein_surgery=(RadioButton)v.findViewById(R.id.rb_pein_surgery);
			rb_pein_surgery.setOnClickListener(this);
			et_pein_surgery_name1=(EditText)v.findViewById(R.id.et_pein_surgery_name1);
			et_pein_surgery_time1=(EditText)v.findViewById(R.id.et_pein_surgery_time1);
			et_pein_surgery_time1.setInputType(InputType.TYPE_NULL);
			et_pein_surgery_time1.setOnClickListener(this);
			et_pein_surgery_name2=(EditText)v.findViewById(R.id.et_pein_surgery_name2);
			et_pein_surgery_time2=(EditText)v.findViewById(R.id.et_pein_surgery_time2);
			et_pein_surgery_time2.setInputType(InputType.TYPE_NULL);
			et_pein_surgery_time2.setOnClickListener(this);
			tv_pein_trauma=(TextView)v.findViewById(R.id.tv_pein_trauma);
			rg_pein_trauma=(RadioGroup)v.findViewById(R.id.rg_pein_trauma);
			rb_pein_nonetrauma=(RadioButton)v.findViewById(R.id.rb_pein_nonetrauma);
			rb_pein_nonetrauma.setOnClickListener(this);
			rb_pein_trauma=(RadioButton)v.findViewById(R.id.rb_pein_trauma);
			rb_pein_trauma.setOnClickListener(this);
			et_pein_trauma_name1=(EditText)v.findViewById(R.id.et_pein_trauma_name1);
			et_pein_trauma_time1=(EditText)v.findViewById(R.id.et_pein_trauma_time1);
			et_pein_trauma_time1.setInputType(InputType.TYPE_NULL);
			et_pein_trauma_time1.setOnClickListener(this);
			et_pein_trauma_name2=(EditText)v.findViewById(R.id.et_pein_trauma_name2);
			et_pein_trauma_time2=(EditText)v.findViewById(R.id.et_pein_trauma_time2);
			et_pein_trauma_time2.setInputType(InputType.TYPE_NULL);
			et_pein_trauma_time2.setOnClickListener(this);
			tv_pein_transfusion=(TextView)v.findViewById(R.id.tv_pein_transfusion);
			rg_pein_transfusion=(RadioGroup)v.findViewById(R.id.rg_pein_transfusion);
			rb_pein_nonetransfusion=(RadioButton)v.findViewById(R.id.rb_pein_nonetransfusion);
			rb_pein_nonetransfusion.setOnClickListener(this);
			rb_pein_transfusion_reason=(RadioButton)v.findViewById(R.id.rb_pein_transfusion_reason);
			rb_pein_transfusion_reason.setOnClickListener(this);
			et_pein_transfusion_reason1=(EditText)v.findViewById(R.id.et_pein_transfusion_reason1);
			et_pein_transfusion_time1=(EditText)v.findViewById(R.id.et_pein_transfusion_time1);
			et_pein_transfusion_time1.setInputType(InputType.TYPE_NULL);
			et_pein_transfusion_time1.setOnClickListener(this);
			et_pein_transfusion_reason2=(EditText)v.findViewById(R.id.et_pein_transfusion_reason2);
			et_pein_transfusion_time2=(EditText)v.findViewById(R.id.et_pein_transfusion_time2);
			et_pein_transfusion_time2.setInputType(InputType.TYPE_NULL);
			et_pein_transfusion_time2.setOnClickListener(this);
			

	}
	//查找个人档案编号和姓名
   public void selectData(){
	   ht=new HereTipa(myContext);
		ht.selectNameAndCode(profileid);
		pi=new PersonInfo(myContext);
		pi.selectPersonInfo(profileid);
   }
   //将布局文件生成View
   public void addToView(){
	   LayoutParams lp=new LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.FILL_PARENT);   
	    this.addView(v,lp);
//	    MyView mv=new MyView(myContext);
//	    this.addView(mv, lp);
   }
   
   /**
	 * 获取性别
	 */
	public int getGender(){
		return gender;
	}
	
	/**
	 * 获取年龄
	 */
	public int getAge(){
		Log.i("person_info->age=", String.valueOf(age));
		return age;
	}
	
	/**
	 * 获取婚姻状况
	 */
	public int getMarriage(){
		return marriage;
	}
	
	/**
	 * 是否患有高血压
	 */
	public boolean getHT(){
		return hasHT;
	}
   
	/**
	 * 是否患有糖尿病
	 */
	public boolean getDiabet(){
		return hasDiabet;
	}
	/**
	 * 是否患精神病
	 */
	public boolean getMentalIll(){
		return hasMentalIll;
	}
	
	/**
   	 * 获取保存后的信息，准备提交
   	 */
   	public PersonInfo getPersonInfo(){
   		return person;
   	}
   	
   	
   	public String getName(){
   		name = et_pein_name.getText().toString();
   		return name;
   	}
   	
   	public String getProfileId(){
   		return this.id;
   	}
   	
   	/**
	 * 检查信息的完整性，必填项不能为空
	 * @return 完整 true，否之 false
	 */
	public boolean checkIntegrity() {
		// TODO Auto-generated method stub
		String temp;
		if(rg_pein_sex.getCheckedRadioButtonId()==-1){
			Toast.makeText(myContext, "请选择性别！", Toast.LENGTH_LONG).show();
			return false;
		}
		temp = et_pein_born.getText().toString();
		if(temp.length()==0){
			Toast.makeText(myContext, "请填写出生日期！", Toast.LENGTH_LONG).show();
			return false;
		}
		temp = et_pein_perid.getText().toString();
		if(temp.length()==0){
			Toast.makeText(myContext, "请填写身份证号码！", Toast.LENGTH_LONG).show();
			return false;
		}
		if(rg_pein_permatent_type.getCheckedRadioButtonId()==-1){
			Toast.makeText(myContext, "请选择常住类型！", Toast.LENGTH_LONG).show();
			return false;
		}
		temp = et_pein_minority.getText().toString();
		if((rg_pein_nation.getCheckedRadioButtonId()==-1)){
			Toast.makeText(myContext, "请选择民族！", Toast.LENGTH_LONG).show();
			return false;
		}
		if((rg_pein_nation.getCheckedRadioButtonId()==1)&&temp.length()==0){
			Toast.makeText(myContext, "请填写少数民族！", Toast.LENGTH_LONG).show();
			return false;
		}
		if(rg_pein_blood_type.getCheckedRadioButtonId()==-1){
			Toast.makeText(myContext, "请选择血型！", Toast.LENGTH_LONG).show();
			return false;
		}
		if(rg_pein_rh_negative.getCheckedRadioButtonId()==-1){
			Toast.makeText(myContext, "请选择RH阴性！", Toast.LENGTH_LONG).show();
			return false;
		}
		if(rg_pein_culture_stdd.getCheckedRadioButtonId()==-1){
			Toast.makeText(myContext, "请选择文化程度！", Toast.LENGTH_LONG).show();
			return false;
		}
		if(!isOccupationSet){
			Toast.makeText(myContext, "请选择职业！", Toast.LENGTH_LONG).show();
			return false;
		}
		if(rg_pein_marriage.getCheckedRadioButtonId()==-1){
			Toast.makeText(myContext, "请选择婚姻状况！", Toast.LENGTH_LONG).show();
			return false;
		}
		return true;
	}
	
	/**
	 * 初始状态，所有填写项为空，选择项未选中
	 */
	public void setInitialState(){
		TextView tvName = (TextView)v.findViewById(R.id.textview1);
		tvName.setVisibility(View.INVISIBLE);
		TextView tvId = (TextView)v.findViewById(R.id.textview_id);
		tvId.setVisibility(View.INVISIBLE);
		et_pein_name.setVisibility(View.INVISIBLE);
	    et_pein_id.setVisibility(View.INVISIBLE);
	     
	}
	
	/**
	 * 提交后所有控件不可编辑
	 */
	public void disableViews(){
		
	}
	
   //初始化个人基本信息表
   	public void initView(){
   		name = ht.getHeti_name();
		if(name!=null){
			et_pein_name.setText(name);
		}
		id = ht.getHeti_here_id();
		if(id!=null){
			et_pein_id.setText(id);
		}
		et_pein_name.setEnabled(false);
		et_pein_id.setEnabled(false);
		
	   if(pi.getPein_sex()>=0){
		   if(pi.getPein_sex()==0){
//			   Log.e("TEST1","rb_sex_weizhi.isChecked()"+rb_pein_unknowsex.isChecked());
			   gender = 0;
			   rg_pein_sex.check(0);
			   rb_pein_unknowsex.setChecked(true);
//			   Log.e("TEST1","rb_sex_weizhi.isChecked()"+rb_pein_unknowsex.isChecked());
		   }
		   if(pi.getPein_sex()==1){
			   gender = 1;
			   rg_pein_sex.check(1);
			   rb_pein_boy.setChecked(true);
		   }
		   if(pi.getPein_sex()==2){
			   gender = 2;
			   rg_pein_sex.check(2);
			   rb_pein_girl.setChecked(true);
		   }
		   if(pi.getPein_sex()==9){
			   gender = 9;
			   rg_pein_sex.check(9);
			   rb_pein_untoldsex.setChecked(true);   
		   }
	   }
	   String birth = pi.getPein_born();
	   if(birth!=null&&birth.length()>0){
		   et_pein_born.setText(pi.getPein_born());
		   int yearOfBirth = Integer.parseInt(birth.substring(0, 4));
			int monthOfBirth = Integer.parseInt(birth.substring(5, 7));
			Calendar cal = Calendar.getInstance();
			int year = cal.get(Calendar.YEAR);
			int month = cal.get(Calendar.MONTH)+1;
				
			if(month>=monthOfBirth){
				age = year-yearOfBirth;//周岁
			}
			else{ 
				age = Math.max(-1, year-yearOfBirth-1);//周岁
			}
	   }
	   if(pi.getPein_perid()!=null){
		   et_pein_perid.setText(pi.getPein_perid());
	   }
	   if(pi.getPein_work()!=null){
		   et_pein_work.setText(pi.getPein_work());
	   }
	   if(pi.getPein_phone()!=null){
		   et_pein_phone.setText(pi.getPein_phone());
	   }
	   if(pi.getPein_contact_name()!=null){
		   et_pein_contact_name.setText(pi.getPein_contact_name());
	   }
	   if(pi.getPein_contact_phone()!=null){
		   et_pein_contact_phone.setText(pi.getPein_contact_phone());
	   }
	   if(pi.getPein_permatent_type()>=0){
		   if(pi.getPein_permatent_type()==1){
			   rg_pein_permatent_type.check(1);
			   rb_pein_register.setChecked(true);   
		   }
		   if(pi.getPein_permatent_type()==2){
			   rg_pein_permatent_type.check(2);
			   rb_pein_unregister.setChecked(true); 
		   }
	   }
	   if(pi.getPein_nation()>=0){
			if(pi.getPein_nation()==1){
				rg_pein_nation.check(1);
				rb_pein_han.setChecked(true);
			}
			if(pi.getPein_nation()==2){
				rg_pein_nation.check(2);
				rb_pein_minority.setChecked(true);
				et_pein_minority.setText(pi.getPein_minority());
			}
	   }
	   if(pi.getPein_blood_type()>=0){
		   	if(pi.getPein_blood_type()==1){
		   		rg_pein_blood_type.check(1);
		   		rb_pein_blood_Atype.setChecked(true);
		   	}
			if(pi.getPein_blood_type()==2){
				rg_pein_blood_type.check(2);
				rb_pein_blood_Btype.setChecked(true);
			}
			if(pi.getPein_blood_type()==3){
				rg_pein_blood_type.check(3);
				rb_pein_blood_Otype.setChecked(true);
			}
			if(pi.getPein_blood_type()==4){
				rg_pein_blood_type.check(4);
				rb_pein_blood_ABtype.setChecked(true);
			}
			if(pi.getPein_blood_type()==5){
				rg_pein_blood_type.check(5);
				rb_pein_blood_nonetype.setChecked(true);
			}
	   }
	   if(pi.getPein_rh_negative()>=0){
			if(pi.getPein_rh_negative()==1){
				rg_pein_rh_negative.check(1);
				rb_pein_rh_negative_y.setChecked(true);
			}
			if(pi.getPein_rh_negative()==2){
				rg_pein_rh_negative.check(2);
				rb_pein_rh_negative_N.setChecked(true);
			}
			if(pi.getPein_rh_negative()==3){
				rg_pein_rh_negative.check(3);
				rb_pein_rh_negative_none.setChecked(true);
			}
	   }
	   if(pi.getPein_culture_stdd()>=0){
			if(pi.getPein_culture_stdd()==1){
				rg_pein_culture_stdd.check(1);
				rb_pein_illiteracy.setChecked(true);
			}
			if(pi.getPein_culture_stdd()==2){
				rg_pein_culture_stdd.check(2);
				rb_pein_grade.setChecked(true);
			}
			if(pi.getPein_culture_stdd()==3){
				rg_pein_culture_stdd.check(3);
				rb_pein_junior.setChecked(true);
			}
			if(pi.getPein_culture_stdd()==4){
				rg_pein_culture_stdd.check(4);
				rb_pein_senior.setChecked(true);
			}
			if(pi.getPein_culture_stdd()==5){
				rg_pein_culture_stdd.check(5);
				rb_pein_college.setChecked(true);
			}
			if(pi.getPein_culture_stdd()==6){
				rg_pein_culture_stdd.check(6);
				rb_pein_noneculture.setChecked(true);
			}
	   }
	   if(pi.getPein_occupation()>=0){
			isOccupationSet = true;
			if(pi.getPein_occupation()==1){
				rb_pein_state_organs.setChecked(true);
			}
			if(pi.getPein_occupation()==2){
				rb_pein_worker.setChecked(true);
			}
			if(pi.getPein_occupation()==3){
				rb_pein_vawirrmqyyoy.setChecked(true);
			}
			if(pi.getPein_occupation()==4){
				rb_pein_commercial.setChecked(true);
			}
			if(pi.getPein_occupation()==5){
				rb_pein_farmer.setChecked(true);
			}
			if(pi.getPein_occupation()==6){
				rb_pein_production.setChecked(true);
			}
			if(pi.getPein_occupation()==7){
				rb_pein_soldier.setChecked(true);
			}
			if(pi.getPein_occupation()==8){
				rb_pein_occ_other.setChecked(true);
			}
	   }
	   if(pi.getPein_marriage()>=0){
			if(pi.getPein_marriage()==1){
				marriage = 1;
				rg_pein_marriage.check(1);
				rb_pein_unmarriage.setChecked(true);
			}
			if(pi.getPein_marriage()==2){
				marriage = 2;
				rg_pein_marriage.check(2);
				rb_pein_marriaged.setChecked(true);
			}
			if(pi.getPein_marriage()==3){
				marriage = 3;
				rg_pein_marriage.check(3);
				rb_pein_sanghun.setChecked(true);
			}
			if(pi.getPein_marriage()==4){
				marriage = 4;
				rg_pein_marriage.check(4);
				rb_pein_divorce.setChecked(true);
			}
			if(pi.getPein_marriage()==5){
				marriage = 5;
				rg_pein_marriage.check(5);
				rb_pein_none_marriage.setChecked(true);
			}
	   }
	   if(pi.getPein_hos_cost_type()!=null&&pi.getPein_hos_cost_type().length()>0){
		   String []hctarr=pi.getPein_hos_cost_type().split(",");
		   if(hctarr!=null&&hctarr.length>0){
			for(int i=0;i<hctarr.length;i++){
				if(Integer.parseInt(hctarr[i])==1){cb_pein_city_worker.setChecked(true);}
				if(Integer.parseInt(hctarr[i])==2){cb_pein_country_resident.setChecked(true);}
				if(Integer.parseInt(hctarr[i])==3){cb_pein_newvillage.setChecked(true);}
				if(Integer.parseInt(hctarr[i])==4){cb_pein_poor.setChecked(true);}
				if(Integer.parseInt(hctarr[i])==5){cb_pein_trade_hos_insurance.setChecked(true);}
				if(Integer.parseInt(hctarr[i])==6){cb_pein_allpubexpense.setChecked(true);}
				if(Integer.parseInt(hctarr[i])==7){cb_pein_allpriexpense.setChecked(true);}
				if(Integer.parseInt(hctarr[i])==8){
					cb_pein_hos_cost_other.setChecked(true);
					et_pein_hos_cost_other.setText(pi.getPein_hos_cost_type_ot());
				}
			}
		   }
	   }
	   if(pi.getPein_drug_allergy()!=null&&pi.getPein_drug_allergy().length()>0){
		   String []dralarr=pi.getPein_drug_allergy().split(",");
		for(int i=0;i<dralarr.length;i++){
			if(Integer.parseInt(dralarr[i])==1){cb_pein_drug_none.setChecked(true);}
			if(Integer.parseInt(dralarr[i])==2){cb_pein_drug_penicillin.setChecked(true);}
			if(Integer.parseInt(dralarr[i])==3){cb_pein_drug_sulfanilamide.setChecked(true);}
			if(Integer.parseInt(dralarr[i])==4){cb_pein_drug_streptomycin.setChecked(true);}
			if(Integer.parseInt(dralarr[i])==5){
				cb_pein_drug_other.setChecked(true);
				et_pein_drug_other.setText(pi.getPein_drug_allergy_ot());
			}
		}
	   }
		//暴露史
	   if(pi.getPein_exposure_his()!=null&&pi.getPein_exposure_his().length()>0){
			String []exhiarr=pi.getPein_exposure_his().split(",");
			if(pi.getPein_exposure_his()!=null&&pi.getPein_exposure_his().length()>0){
			 for(int i=0;i<exhiarr.length;i++){
				if(Integer.parseInt(exhiarr[i])==1){cb_pein_exposure_his_none.setChecked(true);}
				if(Integer.parseInt(exhiarr[i])==2){cb_pein_exposure_his_chemistry.setChecked(true);}
				if(Integer.parseInt(exhiarr[i])==3){cb_pein_exposure_his_poison.setChecked(true);}
				if(Integer.parseInt(exhiarr[i])==4){cb_pein_exposure_his_radial.setChecked(true);}
			 }
			}
	   }
		//疾病
	   if(pi.getPein_disease()!=null&&pi.getPein_disease().length()>0){
		String []disease_arr=pi.getPein_disease().split(",");
		String []disease_date_arr=pi.getPein_disease_date().split(",");
		for(int k=0;k<disease_arr.length;k++){
			if(Integer.parseInt(disease_arr[k])==1){cb_pein_disease_none.setChecked(true);}
			if(Integer.parseInt(disease_arr[k])==2){
				cb_pein_disease_hypertension.setChecked(true);
				hasHT = true;
			}
			if(Integer.parseInt(disease_arr[k])==3){
				cb_pein_disease_diabetesmellitus.setChecked(true);
				hasDiabet = true;
			}
			if(Integer.parseInt(disease_arr[k])==4){cb_pein_disease_coronary.setChecked(true);}
			if(Integer.parseInt(disease_arr[k])==5){cb_pein_disease_cancer.setChecked(true);
									et_pein_disease_cancer.setText(pi.getPein_cancer());}
			if(Integer.parseInt(disease_arr[k])==6){cb_pein_disease_lung.setChecked(true);}
			if(Integer.parseInt(disease_arr[k])==7){cb_pein_disease_stroke.setChecked(true);}
			if(Integer.parseInt(disease_arr[k])==8){
				cb_pein_disease_mental.setChecked(true);
				hasMentalIll = true;
			}
			if(Integer.parseInt(disease_arr[k])==9){cb_pein_disease_tuberculosis.setChecked(true);}
			if(Integer.parseInt(disease_arr[k])==10){cb_pein_disease_hepatitis.setChecked(true);}
			if(Integer.parseInt(disease_arr[k])==11){cb_pein_disease_othercontagion.setChecked(true);}
			if(Integer.parseInt(disease_arr[k])==12){cb_pein_disease_occ.setChecked(true);
									 et_pein_disease_occ.setText(pi.getPein_occ_dis());}
			if(Integer.parseInt(disease_arr[k])==13){cb_pein_disease_other.setChecked(true);
									 et_pein_disease_other.setText(pi.getPein_disease_ot());}
		}
		if(disease_date_arr!=null&&disease_date_arr.length>1){
			for(int i=0;i<disease_date_arr.length;i++){
				if(i==0){
					String []disease_date1=disease_date_arr[i].split("-");
					if(disease_date1!=null&&disease_date1.length>0){
						for(int j=0;j<disease_date1.length;j++){
						if(j==0){	
							tv_pein_disease_date1.setText(disease_date1[j]);
							
						}
						if(j==1){
							et_pein_disease_year1.setText(disease_date1[j]);
							Log.e("TEST1","et_pein_disease_year1"+et_pein_disease_year1.getText().toString());
						}
						if(j==2){et_pein_disease_month1.setText(disease_date1[j]);}
						}
					}
				}
				if(i==1){
					String []disease_date2=disease_date_arr[i].split("-");
					if(disease_date2!=null&&disease_date2.length>0){
						for(int j=0;j<disease_date2.length;j++){
						if(j==0){	
							tv_pein_disease_date2.setText(disease_date2[j]);
							
						}
						if(j==1){
							et_pein_disease_year2.setText(disease_date2[j]);
							Log.e("TEST2","et_pein_disease_year2"+et_pein_disease_year2.getText().toString());
						}
						if(j==2){et_pein_disease_month2.setText(disease_date2[j]);}
						}
					}
				}
				if(i==2){
					String []disease_date3=disease_date_arr[i].split("-");
					if(disease_date3!=null&&disease_date3.length>0){
						for(int j=0;j<disease_date3.length;j++){
						if(j==0){	
							tv_pein_disease_date3.setText(disease_date3[j]);
							
						}
						if(j==1){
							et_pein_disease_year3.setText(disease_date3[j]);
						}
						if(j==2){et_pein_disease_month3.setText(disease_date3[j]);}
						}
					}
				}
				if(i==3){
					String []disease_date4=disease_date_arr[i].split("-");
					if(disease_date4!=null&&disease_date4.length>0){
						for(int j=0;j<disease_date4.length;j++){
						if(j==0){	
							tv_pein_disease_date4.setText(disease_date4[j]);
							
						}
						if(j==1){
							et_pein_disease_year4.setText(disease_date4[j]);
							Log.e("TEST4","et_pein_disease_year4"+et_pein_disease_year4.getText().toString());
						}
						if(j==2){et_pein_disease_month4.setText(disease_date4[j]);}
						}
					}
				}
				if(i==4){
					String []disease_date5=disease_date_arr[i].split("-");
					if(disease_date5!=null&&disease_date5.length>0){
						for(int j=0;j<disease_date5.length;j++){
						if(j==0){	
							tv_pein_disease_date5.setText(disease_date5[j]);	
						}
						if(j==1){
							et_pein_disease_year5.setText(disease_date5[j]);
						}
						if(j==2){et_pein_disease_month5.setText(disease_date5[j]);}
						}
					}
				}
				if(i==5){
					String []disease_date6=disease_date_arr[i].split("-");
					if(disease_date6!=null&&disease_date6.length>0){
						for(int j=0;j<disease_date6.length;j++){
						if(j==0){	
							tv_pein_disease_date6.setText(disease_date6[j]);
						}
						if(j==1){
							et_pein_disease_year6.setText(disease_date6[j]);
						}
						if(j==2){et_pein_disease_month6.setText(disease_date6[j]);}
						}
					}
				}
			}
		}
	   }
		if(pi.getPein_surgery()==1){
			rg_pein_surgery.check(1);
			rb_pein_nonesurgery.setChecked(true);
		}
		if(pi.getPein_surgery()==2){
			rg_pein_surgery.check(2);
			rb_pein_surgery.setChecked(true);
			et_pein_surgery_name1.setText(pi.getPein_surgery_name1());
			et_pein_surgery_time1.setText(pi.getPein_surgery_date1());
			et_pein_surgery_name2.setText(pi.getPein_surgery_name2());
			et_pein_surgery_time2.setText(pi.getPein_surgery_date2());
		}
		if(pi.getPein_trauma()==1){
			rg_pein_trauma.check(1);
			rb_pein_nonetrauma.setChecked(true);
		}
		if(pi.getPein_trauma()==2){
			rg_pein_trauma.check(2);
			rb_pein_trauma.setChecked(true);
			et_pein_trauma_name1.setText(pi.getPein_trauma_name1());
			et_pein_trauma_time1.setText(pi.getPein_trauma_time1());
			et_pein_trauma_name2.setText(pi.getPein_trauma_name2());
			et_pein_trauma_time2.setText(pi.getPein_trauma_time2());
		}
		if(pi.getPein_transfusion()==1){
			rg_pein_transfusion.check(1);
			rb_pein_nonetransfusion.setChecked(true);
			}
		if(pi.getPein_transfusion()==2){
			rg_pein_transfusion.check(2);
			rb_pein_transfusion_reason.setChecked(true);
			et_pein_transfusion_reason1.setText(pi.getPein_trfusion_reason1());
			et_pein_transfusion_time1.setText(pi.getPein_trfusion_time1());
			et_pein_transfusion_reason2.setText(pi.getPein_trfusion_reason2());
			et_pein_transfusion_time2.setText(pi.getPein_trfusion_time2());
		}
   	}
   	//保存个人基本信息表
   	public void saveView(){
   		person = new PersonInfo(myContext);
 	    person.selectPersonInfo(profileid);
 	    if(rb_pein_unknowsex.isChecked()){
 	    	person.setPein_sex(0);
 	    	gender = 0;
 	    }
 	    else if(rb_pein_boy.isChecked()){
 	    	gender = 1;
 	    	person.setPein_sex(1);
 	    }
 	    else if(rb_pein_girl.isChecked()){
 	    	gender = 2;
 	    	person.setPein_sex(2);
 	    }
	    else if(rb_pein_untoldsex.isChecked()){
	    	gender = 9;
	    	person.setPein_sex(9);
	    }
 	    
 	    String temp = et_pein_born.getText().toString();
 	    if(temp!=null&&temp.length()>0){
 	    	person.setPein_born(temp);
 	    	int yearOfBirth = Integer.parseInt(temp.substring(0, 4));
			int monthOfBirth = Integer.parseInt(temp.substring(5, 7));
			Calendar cal = Calendar.getInstance();
			int year = cal.get(Calendar.YEAR);
			int month = cal.get(Calendar.MONTH)+1;
				
			if(month>=monthOfBirth){
				age = year-yearOfBirth;//周岁
			}
			else{ 
				age = Math.max(-1, year-yearOfBirth-1);//周岁
			}
 	    }
 	    	
 	    person.setPein_perid(et_pein_perid.getText().toString());
 	    person.setPein_work(et_pein_work.getText().toString());
 	    person.setPein_phone(et_pein_phone.getText().toString());
 	    person.setPein_contact_name(et_pein_contact_name.getText().toString());
 	    person.setPein_contact_phone(et_pein_contact_phone.getText().toString());
 	    if(rb_pein_register.isChecked()){person.setPein_permatent_type(1);}
	    else if(rb_pein_unregister.isChecked()){person.setPein_permatent_type(2);}
 	    if(rb_pein_han.isChecked()){person.setPein_nation(1);}
		else if(rb_pein_minority.isChecked()){
			person.setPein_nation(2);
			person.setPein_minority(et_pein_minority.getText().toString());
		}
 	  	if(rb_pein_blood_Atype.isChecked()){person.setPein_blood_type(1);}
		else if(rb_pein_blood_Btype.isChecked()){person.setPein_blood_type(2);}
		else if(rb_pein_blood_Otype.isChecked()){person.setPein_blood_type(3);}
		else if(rb_pein_blood_ABtype.isChecked()){person.setPein_blood_type(4);}
		else if(rb_pein_blood_nonetype.isChecked()){person.setPein_blood_type(5);}
	 	if(rb_pein_rh_negative_y.isChecked()){person.setPein_rh_negative(1);}
		else if(rb_pein_rh_negative_N.isChecked()){person.setPein_rh_negative(2);}
		else if(rb_pein_rh_negative_none.isChecked()){person.setPein_rh_negative(3);}
	 	if(rb_pein_illiteracy.isChecked()){person.setPein_culture_stdd(1);}
		else if(rb_pein_grade.isChecked()){person.setPein_culture_stdd(2);}
		else if(rb_pein_junior.isChecked()){person.setPein_culture_stdd(3);}
		else if(rb_pein_senior.isChecked()){person.setPein_culture_stdd(4);}
		else if(rb_pein_college.isChecked()){person.setPein_culture_stdd(5);}
		else if(rb_pein_noneculture.isChecked()){person.setPein_culture_stdd(6);}
	 	if(rb_pein_state_organs.isChecked()){person.setPein_occupation(1);}
		else if(rb_pein_worker.isChecked()){person.setPein_occupation(2);}
		else if(rb_pein_vawirrmqyyoy.isChecked()){person.setPein_occupation(3);}
		else if(rb_pein_commercial.isChecked()){person.setPein_occupation(4);}
		else if(rb_pein_farmer.isChecked()){person.setPein_occupation(5);}
		else if(rb_pein_production.isChecked()){person.setPein_occupation(6);}
		else if(rb_pein_soldier.isChecked()){person.setPein_occupation(7);}
		else if(rb_pein_occ_other.isChecked()){person.setPein_occupation(8);}
	 	if(rb_pein_unmarriage.isChecked()){
	 		marriage = 1;
	 		person.setPein_marriage(1);}
		else if(rb_pein_marriaged.isChecked()){
			marriage = 2;
	 		person.setPein_marriage(2);}
		else if(rb_pein_sanghun.isChecked()){
			marriage = 3;
			person.setPein_marriage(3);}
		else if(rb_pein_divorce.isChecked()){
			marriage = 4;
			person.setPein_marriage(4);}
		else if(rb_pein_none_marriage.isChecked()){
			marriage = 5;
			person.setPein_marriage(5);}
	 	
	 	person.setPein_hos_cost_type(pein_hos_cost_type());
	 	if(cb_pein_hos_cost_other.isChecked()){
	 		person.setPein_hos_cost_type_ot(et_pein_hos_cost_other.getText().toString());
	 	}
	 	person.setPein_drug_allergy(pein_drug_allergy());
	 	if(cb_pein_drug_other.isChecked()){
	 		person.setPein_drug_allergy_ot(et_pein_drug_other.getText().toString());
	 	}
	 	person.setPein_exposure_his(pein_exposure_his());
	 	person.setPein_disease(pein_disease());
	 	if(cb_pein_disease_hypertension.isChecked()){
	 		hasHT = true;
	 	}
	 	if(cb_pein_disease_diabetesmellitus.isChecked()){
	 		hasDiabet = true;
	 	}
	 	if(cb_pein_disease_mental.isChecked()){
	 		hasMentalIll = true;
	 	}
	 	if(cb_pein_disease_cancer.isChecked()){
	 		person.setPein_cancer(et_pein_disease_cancer.getText().toString());
	 	}
	 	if(cb_pein_disease_occ.isChecked()){
	 		person.setPein_occ_dis(et_pein_disease_occ.getText().toString());
	 	}
	 	if(cb_pein_disease_other.isChecked()){
	 		person.setPein_disease_ot(et_pein_disease_other.getText().toString());
	 	}
	 	person.setPein_disease_date(tv_pein_disease_date1.getText().toString()+"-" +
				 et_pein_disease_year1.getText().toString()+"-"+
				 et_pein_disease_month1.getText().toString()+","+
				 tv_pein_disease_date2.getText().toString()+"-"+ 
				 et_pein_disease_year2.getText().toString()+"-"+
				 et_pein_disease_month2.getText().toString()+","+
				 tv_pein_disease_date3.getText().toString()+"-"+ 
				 et_pein_disease_year3.getText().toString()+"-"+
				 et_pein_disease_month3.getText().toString()+","+
				 tv_pein_disease_date4.getText().toString()+"-"+ 
				 et_pein_disease_year4.getText().toString()+"-"+
				 et_pein_disease_month4.getText().toString()+","+
				 tv_pein_disease_date5.getText().toString()+"-"+ 
				 et_pein_disease_year5.getText().toString()+"-"+
				 et_pein_disease_month5.getText().toString()+","+
				 tv_pein_disease_date6.getText().toString()+"-"+
				 et_pein_disease_year6.getText().toString()+"-"+
				 et_pein_disease_month6.getText().toString());
	 	if(rb_pein_nonesurgery.isChecked()){person.setPein_surgery(1);}
		else if(rb_pein_surgery.isChecked()){
			person.setPein_surgery(2);
			person.setPein_surgery_name1(et_pein_surgery_name1.getText().toString());
			person.setPein_surgery_date1(et_pein_surgery_time1.getText().toString());
			person.setPein_surgery_name2(et_pein_surgery_name2.getText().toString());
			person.setPein_surgery_date2(et_pein_surgery_time2.getText().toString());
		}
	 	if(rb_pein_nonetrauma.isChecked()){person.setPein_trauma(1);}
		else if(rb_pein_trauma.isChecked()){
			person.setPein_trauma(2);
			person.setPein_trauma_name1(et_pein_trauma_name1.getText().toString());
			person.setPein_trauma_time1(et_pein_trauma_time1.getText().toString());
			person.setPein_trauma_name2(et_pein_trauma_name2.getText().toString());
			person.setPein_trauma_time2(et_pein_trauma_time2.getText().toString());
		}
	 	if(rb_pein_nonetransfusion.isChecked()){person.setPein_transfusion(1);}
		else if(rb_pein_transfusion_reason.isChecked()){
			person.setPein_transfusion(2);
			person.setPein_trfusion_reason1(et_pein_transfusion_reason1.getText().toString());
			person.setPein_trfusion_time1(et_pein_transfusion_time1.getText().toString());
			person.setPein_trfusion_reason2(et_pein_transfusion_reason2.getText().toString());
			person.setPein_trfusion_time2(et_pein_transfusion_time2.getText().toString());
		}
	 	person.updatePersonInfo(profileid);		
   	}
   	
   	
   	public String pein_hos_cost_type(){
		String r="";
	//	int j=0;
		String m="";
		CheckBox []cb_pein_hos_cost_type={cb_pein_city_worker,cb_pein_country_resident,cb_pein_newvillage,cb_pein_poor,
											cb_pein_trade_hos_insurance,cb_pein_allpubexpense,
											cb_pein_allpriexpense,cb_pein_hos_cost_other};
		
			for(int i=0;i<cb_pein_hos_cost_type.length;i++){
				if(cb_pein_hos_cost_type[i].isChecked()){
					m=Integer.toString(i+1);
					r=r+m+",";
		//			j++;
				}
		//		if(j>=3){cb_pein_hos_cost_type[i].setEnabled(false);}
			}
		return r;
	}
   	public String pein_drug_allergy(){
		String r="";
	//	int j=0;
		String m="";
		CheckBox []cb_pein_drug_allergy={cb_pein_drug_none,cb_pein_drug_penicillin,cb_pein_drug_sulfanilamide,
										 cb_pein_drug_streptomycin,cb_pein_drug_other};
		
	//	if(cb_pein_drug_none.isChecked()){
	//		r="1";
		//	for(int i=0;i<cb_pein_drug_allergy.length;i++){
		//		cb_pein_drug_allergy[i].setEnabled(false);
		//	}
	//	}
		
			for(int i=0;i<cb_pein_drug_allergy.length;i++){
				if(cb_pein_drug_allergy[i].isChecked()){
					m=Integer.toString(i+1);
					r=r+m+",";
				//	j++;
				}
			//	if(j>=4){cb_pein_drug_allergy[i].setEnabled(false);}
			}
		return r;
	}
   	public String pein_exposure_his(){
		String r="";
	//	int j=0;
		String m="";
		CheckBox []cb_pein_exposure_his={cb_pein_exposure_his_none,cb_pein_exposure_his_chemistry,
										cb_pein_exposure_his_poison,cb_pein_exposure_his_radial};
		
		
		
			for(int i=0;i<cb_pein_exposure_his.length;i++){
				if(cb_pein_exposure_his[i].isChecked()){
					m=Integer.toString(i+1);
					r=r+m+",";
		//			j++;
				}
			//	if(j>=3){cb_pein_exposure_his[i].setEnabled(false);}
			}
		return r;
	}
   	public String pein_disease(){
		String r="";
	//	int j=0;
		String m="";
		CheckBox []cb_pein_disease={cb_pein_disease_none,cb_pein_disease_hypertension,cb_pein_disease_diabetesmellitus,
							cb_pein_disease_coronary,cb_pein_disease_cancer,cb_pein_disease_lung,
							cb_pein_disease_stroke,cb_pein_disease_mental,cb_pein_disease_tuberculosis,
							cb_pein_disease_hepatitis,cb_pein_disease_othercontagion,
							cb_pein_disease_occ,cb_pein_disease_other};
		TextView []tv_pein_disease_date={tv_pein_disease_date1,tv_pein_disease_date2,
										 tv_pein_disease_date3,tv_pein_disease_date4,
										 tv_pein_disease_date5,tv_pein_disease_date6};
		
	
			for(int i=0;i<cb_pein_disease.length;i++){
				if(cb_pein_disease[i].isChecked()){
					m=Integer.toString(i+1);
					r=r+m+",";
			//		j++;
			/*		if(i<10){
						tv_pein_disease_date[j].setText("0"+m);
					}else{
						tv_pein_disease_date[j].setText(m);
					}  */
				}  
			//	if(j>=6){cb_pein_disease[i].setEnabled(false);}  
			}
	//	}
		return r;
	}
//    class MyView extends View {
//    //	View v;
////    	Paint paint;
//    	
//		public MyView(Context context) {
//			super(context);
//			paint=new Paint();
//			paint.setStyle(Paint.Style.STROKE);
//            paint.setColor(Color.BLACK);
//		}
//	
//		public void onDraw(Canvas c){
//	        int top=ll1.getTop();
//	        int left=ll1.getLeft()+30;
//	        int right=ll1.getRight()+20;
//	        int y=0;//sv.getScrollY();
//	       //  int y_m=tv.getHeight()/10;
//	        top=top-y;
//	        //System.out.println("top===="+top);
//	        //System.out.println("sv.top==="+sv.getScrollY());
//	        //划横线
//	        c.drawLine(left, top, right, top, paint);
//	        c.drawLine(left, top+40, right, top+40, paint);
//	        c.drawLine(left, top+80, right, top+80, paint);
//	        c.drawLine(left, top+120, right, top+120, paint);
//	        c.drawLine(left, top+160, right, top+160, paint);//常住类型
//	        c.drawLine(left, top+204, right, top+204, paint);
//	        c.drawLine(left, top+250, right, top+250, paint);  //文化程度
//	        c.drawLine(left, top+374, right, top+374, paint);
//	        c.drawLine(left, top+414, right, top+414, paint);
//	        c.drawLine(left, top+505, right, top+505, paint);
//	        c.drawLine(left, top+550, right, top+550, paint);  //药物过敏史
//	        c.drawLine(left, top+600, right, top+600, paint);
//	        
//	        c.drawLine(left+30, top+850, right, top+850, paint);
//	        c.drawLine(left+30, top+890, right, top+890, paint); 
//	        c.drawLine(left+30, top+935, right, top+935, paint);
//	        c.drawLine(left, top+975, right, top+975, paint); 
//	        
//	        //画竖线
//	        c.drawLine(left, top, left, top+975, paint);
//	        c.drawLine(right, top, right, top+975, paint);
//	        c.drawLine(left+100, top, left+100, top+975, paint);
//	        c.drawLine(left+350, top+40, left+350, top+160, paint);	      
//	        c.drawLine(left+230, top+80, left+230, top+120, paint);	        
//	        c.drawLine(left+485, top, left+485, top+160, paint);  //出生日期前的竖线
//	        c.drawLine(left+560, top, left+560, top+40, paint);
//	        c.drawLine(left+590, top+80, left+590, top+120, paint);	        
//	        c.drawLine(left+30, top+600, left+30, top+975, paint); 
//	    
//		}
//    	
//    }
    //为某些组件设置监听事件
    
    public void onFocusChange(View v, boolean hasFocus) {
		// TODO Auto-generated method stub
		if(v==et_pein_born&&hasFocus){
			showDateDialog(et_pein_born);
//			mPopupWindow = new MyPopupWindow(myContext);			
//			mPopupWindow.showAtLocation(findViewById(R.id.et_pein_born), Gravity.CENTER, 0, 0);
//
//			Button btn=mPopupWindow.getButton();
//			btn.setOnClickListener(new OnClickListener(){
//
//				@Override
//				public void onClick(View v) {
//					// TODO Auto-generated method stub
//					et_pein_born.setText(mPopupWindow.getDate());
//					mPopupWindow.dismiss();
//				}
//				
//			});
		}
    }
	
    
    
    
    public void onClick(View v) {
		// TODO Auto-generated method stub  	
 /*   	tv_pein_disease_date1.setText("");
    	tv_pein_disease_date2.setText("");
    	tv_pein_disease_date3.setText("");
    	tv_pein_disease_date4.setText("");
    	tv_pein_disease_date5.setText("");
    	tv_pein_disease_date6.setText("");*/
		if(v==et_pein_born){
			showDateDialog(et_pein_born);
//			mPopupWindow = new MyPopupWindow(myContext);			
//			mPopupWindow.showAtLocation(v.findViewById(R.id.et_pein_born), Gravity.CENTER, 0, 0);
//
//			Button btn=mPopupWindow.getButton();
//			btn.setOnClickListener(new OnClickListener(){
//				@Override
//				public void onClick(View v) {
//					// TODO Auto-generated method stub
//					et_pein_born.setText(mPopupWindow.getDate());
//					mPopupWindow.dismiss();
//				}
//				
//			});
		}
		else if(v==rb_pein_han){
			if(rb_pein_han.isChecked()){
				et_pein_minority.setText("");
				et_pein_minority.setEnabled(false);
			}
			else{
				et_pein_minority.setEnabled(true);
			} 
		}
		else if(v==rb_pein_minority){
			et_pein_minority.requestFocus();
			et_pein_minority.setEnabled(true);
		}
		else if(v==rb_pein_state_organs){
			rb_pein_state_organs.setChecked(true);
			isOccupationSet = true;
			rb_pein_worker.setChecked(false);
			isOccupationSet = true;
			rb_pein_vawirrmqyyoy.setChecked(false);
			rb_pein_commercial.setChecked(false);
			rb_pein_farmer.setChecked(false);
			rb_pein_production.setChecked(false);
			rb_pein_soldier.setChecked(false);
			rb_pein_occ_other.setChecked(false);
		}
		else if(v==rb_pein_worker){
			rb_pein_state_organs.setChecked(false);
			rb_pein_worker.setChecked(true);
			isOccupationSet = true;
			rb_pein_vawirrmqyyoy.setChecked(false);
			rb_pein_commercial.setChecked(false);
			rb_pein_farmer.setChecked(false);
			rb_pein_production.setChecked(false);
			rb_pein_soldier.setChecked(false);
			rb_pein_occ_other.setChecked(false);
		}
		else if(v==rb_pein_vawirrmqyyoy){
			rb_pein_state_organs.setChecked(false);
			rb_pein_worker.setChecked(false);
			rb_pein_vawirrmqyyoy.setChecked(true);
			isOccupationSet = true;
			rb_pein_commercial.setChecked(false);
			rb_pein_farmer.setChecked(false);
			rb_pein_production.setChecked(false);
			rb_pein_soldier.setChecked(false);
			rb_pein_occ_other.setChecked(false);
		}
		else if(v==rb_pein_commercial){
			rb_pein_state_organs.setChecked(false);
			rb_pein_worker.setChecked(false);
			rb_pein_vawirrmqyyoy.setChecked(false);
			rb_pein_commercial.setChecked(true);
			rb_pein_farmer.setChecked(false);
			isOccupationSet = true;
			rb_pein_production.setChecked(false);
			rb_pein_soldier.setChecked(false);
			rb_pein_occ_other.setChecked(false);
		}
		else if(v==rb_pein_farmer){
			rb_pein_state_organs.setChecked(false);
			rb_pein_worker.setChecked(false);
			rb_pein_vawirrmqyyoy.setChecked(false);
			rb_pein_commercial.setChecked(false);
			rb_pein_farmer.setChecked(true);
			rb_pein_production.setChecked(false);
			rb_pein_soldier.setChecked(false);
			rb_pein_occ_other.setChecked(false);
			isOccupationSet = true;
		}
		else if(v==rb_pein_production){
			rb_pein_state_organs.setChecked(false);
			rb_pein_worker.setChecked(false);
			rb_pein_vawirrmqyyoy.setChecked(false);
			rb_pein_commercial.setChecked(false);
			rb_pein_farmer.setChecked(false);
			rb_pein_production.setChecked(true);
			isOccupationSet = true;
			rb_pein_soldier.setChecked(false);
			rb_pein_occ_other.setChecked(false);
		}
		else if(v==rb_pein_soldier){
			rb_pein_state_organs.setChecked(false);
			rb_pein_worker.setChecked(false);
			rb_pein_vawirrmqyyoy.setChecked(false);
			rb_pein_commercial.setChecked(false);
			rb_pein_farmer.setChecked(false);
			rb_pein_production.setChecked(false);
			rb_pein_soldier.setChecked(true);
			isOccupationSet = true;
			rb_pein_occ_other.setChecked(false);
		}
		else if(v==rb_pein_occ_other){
			rb_pein_state_organs.setChecked(false);
			rb_pein_worker.setChecked(false);
			rb_pein_vawirrmqyyoy.setChecked(false);
			rb_pein_commercial.setChecked(false);
			rb_pein_farmer.setChecked(false);
			rb_pein_production.setChecked(false);
			rb_pein_soldier.setChecked(false);
			rb_pein_occ_other.setChecked(true);
			isOccupationSet = true;
		}

		else if(v==cb_pein_city_worker){
	  		if(cb_pein_city_worker.isChecked()){
				n++;	
			}
			else{n--;}
			if(n>3){
				Toast.makeText(getContext(), "最多可选三项",
					Toast.LENGTH_SHORT).show();
				cb_pein_city_worker.setChecked(false);
				n--;
			}
			
			System.out.println(n);
		}
		
		else if(v==cb_pein_country_resident){
			if(cb_pein_country_resident.isChecked()){
				n++;
				}
			else{n--;}
			if(n>3){
				Toast.makeText(getContext(), "最多可选三项",
					Toast.LENGTH_SHORT).show();
				cb_pein_country_resident.setChecked(false); 
				n--;
			}
			System.out.println(n);
		}
		else if(v==cb_pein_newvillage){
			if(cb_pein_newvillage.isChecked()){
				n++;				
			}
			else{n--;}
			if(n>3){
				Toast.makeText(getContext(), "最多可选三项",
					Toast.LENGTH_SHORT).show();
				cb_pein_newvillage.setChecked(false);
				n--;
			}
			System.out.println(n);
		}
		else if(v==cb_pein_poor){
			if(cb_pein_poor.isChecked()){
				n++;		
			}
			else{n--;}
			if(n>3){
				Toast.makeText(getContext(), "最多可选三项",
					Toast.LENGTH_SHORT).show();
				cb_pein_poor.setChecked(false);
				n--;
			}
			System.out.println(n);
		}
		else if(v==cb_pein_trade_hos_insurance){
			if(cb_pein_trade_hos_insurance.isChecked()){
				n++;
			}
			else{n--;}
			if(n>3){
				Toast.makeText(getContext(), "最多可选三项",
					Toast.LENGTH_SHORT).show();
				cb_pein_trade_hos_insurance.setChecked(false);
				n--;
			}
			System.out.println(n);
		}
		else if(v==cb_pein_allpubexpense){
			if(cb_pein_allpubexpense.isChecked()){
				n++;
			}
			else{n--;}
			if(n>3){
				Toast.makeText(getContext(), "最多可选三项",
					Toast.LENGTH_SHORT).show();
				cb_pein_allpubexpense.setChecked(false);
				n--;
			}
			System.out.println(n);
		}
		else if(v==cb_pein_allpriexpense){
			if(cb_pein_allpriexpense.isChecked()){
				n++;
			}
			else{n--;}
			if(n>3){
				Toast.makeText(getContext(), "最多可选三项",
					Toast.LENGTH_SHORT).show();
				cb_pein_allpriexpense.setChecked(false);
				n--;
			}
			System.out.println(n);
		}
		else if(v==cb_pein_hos_cost_other){
			if(cb_pein_hos_cost_other.isChecked()){
				n++;
				et_pein_hos_cost_other.requestFocus();
				et_pein_hos_cost_other.setEnabled(true);
			}
			else{
				n--;
				et_pein_hos_cost_other.setText("");
				et_pein_hos_cost_other.setEnabled(false);
				}
			if(n>3){
				Toast.makeText(getContext(), "最多可选三项",
					Toast.LENGTH_SHORT).show();
				cb_pein_hos_cost_other.setChecked(false);
				n--;
			}
			System.out.println(n);
		}
		else if(v==cb_pein_drug_none){
		//	cb_pein_drug_none.setChecked(true);
			cb_pein_drug_penicillin.setChecked(false);
			cb_pein_drug_sulfanilamide.setChecked(false);
			cb_pein_drug_streptomycin.setChecked(false);
			cb_pein_drug_other.setChecked(false);
			et_pein_drug_other.setText("");
		}
		else if(v==cb_pein_drug_penicillin){
			cb_pein_drug_none.setChecked(false);
		}
		else if(v==cb_pein_drug_sulfanilamide){
			cb_pein_drug_none.setChecked(false);
		}
		else if(v==cb_pein_drug_streptomycin){
			cb_pein_drug_none.setChecked(false);
		}
		else if(v==cb_pein_drug_other){
			cb_pein_drug_none.setChecked(false);
			if(cb_pein_drug_other.isChecked()){
				et_pein_drug_other.requestFocus();
				et_pein_drug_other.setEnabled(true);
			}else{
				et_pein_drug_other.setEnabled(false);
				et_pein_drug_other.setText("");
			}
		}
		else if(v==cb_pein_exposure_his_none){
		//	cb_pein_exposure_his_none.setChecked(true);
			cb_pein_exposure_his_chemistry.setChecked(false);
			cb_pein_exposure_his_poison.setChecked(false);
			cb_pein_exposure_his_radial.setChecked(false);
			
		}
		else if(v==cb_pein_exposure_his_chemistry){
			cb_pein_exposure_his_none.setChecked(false);
		}
		else if(v==cb_pein_exposure_his_poison){
			cb_pein_exposure_his_none.setChecked(false);
		}
		else if(v==cb_pein_exposure_his_radial){
			cb_pein_exposure_his_none.setChecked(false);
		}
		else if(v==cb_pein_disease_none){
		//	cb_pein_disease_none.setChecked(true);
			cb_pein_disease_hypertension.setChecked(false);
			cb_pein_disease_diabetesmellitus.setChecked(false);
			cb_pein_disease_coronary.setChecked(false);
			cb_pein_disease_cancer.setChecked(false);
			cb_pein_disease_lung.setChecked(false);
			cb_pein_disease_stroke.setChecked(false);
			cb_pein_disease_mental.setChecked(false);
			cb_pein_disease_tuberculosis.setChecked(false);
			cb_pein_disease_hepatitis.setChecked(false);
			cb_pein_disease_othercontagion.setChecked(false);
			cb_pein_disease_occ.setChecked(false);
			cb_pein_disease_other.setChecked(false);
			tv_pein_disease_date1.setText("");
			tv_pein_disease_date2.setText("");
			tv_pein_disease_date3.setText("");
			tv_pein_disease_date4.setText("");
			tv_pein_disease_date5.setText("");
			tv_pein_disease_date6.setText("");
			et_pein_disease_year1.setText("");
			et_pein_disease_month1.setText("");
			et_pein_disease_year2.setText("");
			et_pein_disease_month2.setText("");
			et_pein_disease_year3.setText("");
			et_pein_disease_month3.setText("");
			et_pein_disease_year4.setText("");
			et_pein_disease_month4.setText("");
			et_pein_disease_year5.setText("");
			et_pein_disease_month5.setText("");
			et_pein_disease_year6.setText("");
			et_pein_disease_month6.setText("");
			k=0;
		}
		else if(v==cb_pein_disease_hypertension){
			if(cb_pein_disease_hypertension.isChecked()){
				k++;
				cb_pein_disease_none.setChecked(false);
		/*		for(int j=0;j<tv_pein_disease_date.length;j++){
					if(!tv_pein_disease_date[j].isSelected()){
						tv_pein_disease_date[j].setText("02");   
					//	tv_pein_disease_date[j].get;
						
					}
					break;
				}     */ 
				
				if(!(tv_pein_disease_date1.getText().toString().length()>0)){
					tv_pein_disease_date1.setText("02");	
				}
				else if(!(tv_pein_disease_date2.getText().toString().length()>0)){
					tv_pein_disease_date2.setText("02");
				}
				else if(!(tv_pein_disease_date3.getText().toString().length()>0)){
					tv_pein_disease_date3.setText("02");
				}
				else if(!(tv_pein_disease_date4.getText().toString().length()>0)){
					tv_pein_disease_date4.setText("02");
				}
				else if(!(tv_pein_disease_date5.getText().toString().length()>0)){
					tv_pein_disease_date5.setText("02");
				}
				else if(!(tv_pein_disease_date6.getText().toString().length()>0)){
					tv_pein_disease_date6.setText("02");
				}      
			}
			else{
				k--;
				if(tv_pein_disease_date1.getText().toString()=="02"){
					tv_pein_disease_date1.setText("");
					et_pein_disease_year1.setText("");
					et_pein_disease_month1.setText("");
				}
				else if(tv_pein_disease_date2.getText().toString()=="02"){
					tv_pein_disease_date2.setText("");
					et_pein_disease_year2.setText("");
					et_pein_disease_month2.setText("");
				}
				else if(tv_pein_disease_date3.getText().toString()=="02"){
					tv_pein_disease_date3.setText("");
					et_pein_disease_year3.setText("");
					et_pein_disease_month3.setText("");
				}
				else if(tv_pein_disease_date4.getText().toString()=="02"){
					tv_pein_disease_date4.setText("");
					et_pein_disease_year4.setText("");
					et_pein_disease_month4.setText("");
				}
				else if(tv_pein_disease_date5.getText().toString()=="02"){
					tv_pein_disease_date5.setText("");
					et_pein_disease_year5.setText("");
					et_pein_disease_month5.setText("");
				}
				else if(tv_pein_disease_date6.getText().toString()=="02"){
					tv_pein_disease_date6.setText("");
					et_pein_disease_year6.setText("");
					et_pein_disease_month6.setText("");
				}
			}       
			if(k>6){
				Toast.makeText(getContext(), "您最多可选六项",Toast.LENGTH_SHORT).show();
				cb_pein_disease_hypertension.setChecked(false);
				k--;
			}
			
		}
		else if(v==cb_pein_disease_diabetesmellitus){
			if(cb_pein_disease_diabetesmellitus.isChecked()){
				cb_pein_disease_none.setChecked(false);
				k++;
				if(!(tv_pein_disease_date1.getText().toString().length()>0)){
					tv_pein_disease_date1.setText("03");	
				}
				else if(!(tv_pein_disease_date2.getText().toString().length()>0)){
					tv_pein_disease_date2.setText("03");
				}
				else if(!(tv_pein_disease_date3.getText().toString().length()>0)){
					tv_pein_disease_date3.setText("03");
				}
				else if(!(tv_pein_disease_date4.getText().toString().length()>0)){
					tv_pein_disease_date4.setText("03");
				}
				else if(!(tv_pein_disease_date5.getText().toString().length()>0)){
					tv_pein_disease_date5.setText("03");
				}
				else if(!(tv_pein_disease_date6.getText().toString().length()>0)){
					tv_pein_disease_date6.setText("03");
				}    
			}
			else{
				k--;
				if(tv_pein_disease_date1.getText().toString()=="03"){
					tv_pein_disease_date1.setText("");
					et_pein_disease_year1.setText("");
					et_pein_disease_month1.setText("");
				}
				else if(tv_pein_disease_date2.getText().toString()=="03"){
					tv_pein_disease_date2.setText("");
					et_pein_disease_year2.setText("");
					et_pein_disease_month2.setText("");
				}
				else if(tv_pein_disease_date3.getText().toString()=="03"){
					tv_pein_disease_date3.setText("");
					et_pein_disease_year3.setText("");
					et_pein_disease_month3.setText("");
				}
				else if(tv_pein_disease_date4.getText().toString()=="03"){
					tv_pein_disease_date4.setText("");
					et_pein_disease_year4.setText("");
					et_pein_disease_month4.setText("");
				}
				else if(tv_pein_disease_date5.getText().toString() =="03"){
					tv_pein_disease_date5.setText("");
					et_pein_disease_year5.setText("");
					et_pein_disease_month5.setText("");
				}
				else if(tv_pein_disease_date6.getText().toString()=="03"){
					tv_pein_disease_date6.setText("");
					et_pein_disease_year6.setText("");
					et_pein_disease_month6.setText("");
				}
			}
			if(k>6){
				Toast.makeText(getContext(), "您最多可选六项",Toast.LENGTH_SHORT).show();
				cb_pein_disease_diabetesmellitus.setChecked(false);
				k--;
			}
		}
		else if(v==cb_pein_disease_coronary){		
			if(cb_pein_disease_coronary.isChecked()){
				cb_pein_disease_none.setChecked(false);
				k++;
				if(!(tv_pein_disease_date1.getText().toString().length()>0)){
					tv_pein_disease_date1.setText("04");	
				}
				else if(!(tv_pein_disease_date2.getText().toString().length()>0)){
					tv_pein_disease_date2.setText("04");
				}
				else if(!(tv_pein_disease_date3.getText().toString().length()>0)){
					tv_pein_disease_date3.setText("04");
				}
				else if(!(tv_pein_disease_date4.getText().toString().length()>0)){
					tv_pein_disease_date4.setText("04");
				}
				else if(!(tv_pein_disease_date5.getText().toString().length()>0)){
					tv_pein_disease_date5.setText("04");
				}
				else if(!(tv_pein_disease_date6.getText().toString().length()>0)){
					tv_pein_disease_date6.setText("04");
				}   
			}
			else{
				k--;
				if(tv_pein_disease_date1.getText().toString()=="04"){
					tv_pein_disease_date1.setText("");
					et_pein_disease_year1.setText("");
					et_pein_disease_month1.setText("");
				}
				else if(tv_pein_disease_date2.getText().toString()=="04"){
					tv_pein_disease_date2.setText("");
					et_pein_disease_year2.setText("");
					et_pein_disease_month2.setText("");
				}
				else if(tv_pein_disease_date3.getText().toString()=="04"){
					tv_pein_disease_date3.setText("");
					et_pein_disease_year3.setText("");
					et_pein_disease_month3.setText("");
				}
				else if(tv_pein_disease_date4.getText().toString()=="04"){
					tv_pein_disease_date4.setText("");
					et_pein_disease_year4.setText("");
					et_pein_disease_month4.setText("");
				}
				else if(tv_pein_disease_date5.getText().toString()=="04"){
					tv_pein_disease_date5.setText("");
					et_pein_disease_year5.setText("");
					et_pein_disease_month5.setText("");
				}
				else if(tv_pein_disease_date6.getText().toString()=="04"){
					tv_pein_disease_date6.setText("");
					et_pein_disease_year6.setText("");
					et_pein_disease_month6.setText("");
				}
			}
			if(k>6){
				Toast.makeText(getContext(), "您最多可选六项",Toast.LENGTH_SHORT).show();
				cb_pein_disease_coronary.setChecked(false);
				k--;
			}
		}
		else if(v==cb_pein_disease_cancer){
			cb_pein_disease_none.setChecked(false);
			if(cb_pein_disease_cancer.isChecked()){
				k++;
				et_pein_disease_cancer.requestFocus();
				cb_pein_disease_cancer.setEnabled(true);
				if(!(tv_pein_disease_date1.getText().toString().length()>0)){
					tv_pein_disease_date1.setText("05");	
				}
				else if(!(tv_pein_disease_date2.getText().toString().length()>0)){
					tv_pein_disease_date2.setText("05");
				}
				else if(!(tv_pein_disease_date3.getText().toString().length()>0)){
					tv_pein_disease_date3.setText("05");
				}
				else if(!(tv_pein_disease_date4.getText().toString().length()>0)){
					tv_pein_disease_date4.setText("05");
				}
				else if(!(tv_pein_disease_date5.getText().toString().length()>0)){
					tv_pein_disease_date5.setText("05");
				}
				else if(!(tv_pein_disease_date6.getText().toString().length()>0)){
					tv_pein_disease_date6.setText("05");
				}   
			}
			else {
				k--;
				cb_pein_disease_cancer.setEnabled(false);
				et_pein_disease_cancer.setText("");
				if(tv_pein_disease_date1.getText().toString()=="05"){
					tv_pein_disease_date1.setText("");
					et_pein_disease_year1.setText("");
					et_pein_disease_month1.setText("");
				}
				else if(tv_pein_disease_date2.getText().toString()=="05"){
					tv_pein_disease_date2.setText("");
					et_pein_disease_year2.setText("");
					et_pein_disease_month2.setText("");
				}
				else if(tv_pein_disease_date3.getText().toString()=="05"){
					tv_pein_disease_date3.setText("");
					et_pein_disease_year3.setText("");
					et_pein_disease_month3.setText("");
				}
				else if(tv_pein_disease_date4.getText().toString()=="05"){
					tv_pein_disease_date4.setText("");
					et_pein_disease_year4.setText("");
					et_pein_disease_month4.setText("");
				}
				else if(tv_pein_disease_date5.getText().toString()=="05"){
					tv_pein_disease_date5.setText("");
					et_pein_disease_year5.setText("");
					et_pein_disease_month5.setText("");
				}
				else if(tv_pein_disease_date6.getText().toString()=="05"){
					tv_pein_disease_date6.setText("");
					et_pein_disease_year6.setText("");
					et_pein_disease_month6.setText("");
				}	
			}
			if(k>6){
				Toast.makeText(getContext(), "您最多可选六项",Toast.LENGTH_SHORT).show();
				cb_pein_disease_cancer.setChecked(false);
				k--;
			}
		}
		else if(v==cb_pein_disease_lung){
			cb_pein_disease_none.setChecked(false);
			if(cb_pein_disease_lung.isChecked()){
				k++;
					if(!(tv_pein_disease_date1.getText().toString().length()>0)){
						tv_pein_disease_date1.setText("06");	
					}
					else if(!(tv_pein_disease_date2.getText().toString().length()>0)){
						tv_pein_disease_date2.setText("06");
					}
					else if(!(tv_pein_disease_date3.getText().toString().length()>0)){
						tv_pein_disease_date3.setText("06");
					}
					else if(!(tv_pein_disease_date4.getText().toString().length()>0)){
						tv_pein_disease_date4.setText("06");
					}
					else if(!(tv_pein_disease_date5.getText().toString().length()>0)){
						tv_pein_disease_date5.setText("06");
					}
					else if(!(tv_pein_disease_date6.getText().toString().length()>0)){
						tv_pein_disease_date6.setText("06");
					}   
				}
				else {
					k--;
					if(tv_pein_disease_date1.getText().toString()=="06"){
						tv_pein_disease_date1.setText("");
						et_pein_disease_year1.setText("");
						et_pein_disease_month1.setText("");
					}
					else if(tv_pein_disease_date2.getText().toString()=="06"){
						tv_pein_disease_date2.setText("");
						et_pein_disease_year2.setText("");
						et_pein_disease_month2.setText("");
					}
					else if(tv_pein_disease_date3.getText().toString()=="06"){
						tv_pein_disease_date3.setText("");
						et_pein_disease_year3.setText("");
						et_pein_disease_month3.setText("");
					}
					else if(tv_pein_disease_date4.getText().toString()=="06"){
						tv_pein_disease_date4.setText("");
						et_pein_disease_year4.setText("");
						et_pein_disease_month4.setText("");
					}
					else if(tv_pein_disease_date5.getText().toString()=="06"){
						tv_pein_disease_date5.setText("");
						et_pein_disease_year5.setText("");
						et_pein_disease_month5.setText("");
					}
					else if(tv_pein_disease_date6.getText().toString()=="06"){
						tv_pein_disease_date6.setText("");
						et_pein_disease_year6.setText("");
						et_pein_disease_month6.setText("");
					}	
				}
			if(k>6){
				Toast.makeText(getContext(), "您最多可选六项",Toast.LENGTH_SHORT).show();
				cb_pein_disease_lung.setChecked(false);
				k--;
			}
		}
		else if(v==cb_pein_disease_stroke){
			cb_pein_disease_none.setChecked(false);
			if(cb_pein_disease_stroke.isChecked()){
				k++;
				if(!(tv_pein_disease_date1.getText().toString().length()>0)){
					tv_pein_disease_date1.setText("07");	
				}
				else if(!(tv_pein_disease_date2.getText().toString().length()>0)){
					tv_pein_disease_date2.setText("07");
				}
				else if(!(tv_pein_disease_date3.getText().toString().length()>0)){
					tv_pein_disease_date3.setText("07");
				}
				else if(!(tv_pein_disease_date4.getText().toString().length()>0)){
					tv_pein_disease_date4.setText("07");
				}
				else if(!(tv_pein_disease_date5.getText().toString().length()>0)){
					tv_pein_disease_date5.setText("07");
				}
				else if(!(tv_pein_disease_date6.getText().toString().length()>0)){
					tv_pein_disease_date6.setText("07");
				}   
			}
			else {
				k--;
				if(tv_pein_disease_date1.getText().toString()=="07"){
					tv_pein_disease_date1.setText("");
					et_pein_disease_year1.setText("");
					et_pein_disease_month1.setText("");
				}
				else if(tv_pein_disease_date2.getText().toString()=="07"){
					tv_pein_disease_date2.setText("");
					et_pein_disease_year2.setText("");
					et_pein_disease_month2.setText("");
				}
				else if(tv_pein_disease_date3.getText().toString()=="07"){
					tv_pein_disease_date3.setText("");
					et_pein_disease_year3.setText("");
					et_pein_disease_month3.setText("");
				}
				else if(tv_pein_disease_date4.getText().toString()=="07"){
					tv_pein_disease_date4.setText("");
					et_pein_disease_year4.setText("");
					et_pein_disease_month4.setText("");
				}
				else if(tv_pein_disease_date5.getText().toString()=="07"){
					tv_pein_disease_date5.setText("");
					et_pein_disease_year5.setText("");
					et_pein_disease_month5.setText("");
				}
				else if(tv_pein_disease_date6.getText().toString()=="07"){
					tv_pein_disease_date6.setText("");
					et_pein_disease_year6.setText("");
					et_pein_disease_month6.setText("");
				}	
			}
			if(k>6){
				Toast.makeText(getContext(), "您最多可选六项",Toast.LENGTH_SHORT).show();
				cb_pein_disease_stroke.setChecked(false);
				k--;
			}
	/*		for(int j=0;j<tv_pein_disease_date.length;j++){
				if(!tv_pein_disease_date[j].isEnabled()){
					tv_pein_disease_date[j].setText("07");
				}
				break;
			}*/
		}
		else if(v==cb_pein_disease_mental){
			cb_pein_disease_none.setChecked(false);
			if(cb_pein_disease_mental.isChecked()){
				k++;
				if(!(tv_pein_disease_date1.getText().toString().length()>0)){
					tv_pein_disease_date1.setText("08");	
				}
				else if(!(tv_pein_disease_date2.getText().toString().length()>0)){
					tv_pein_disease_date2.setText("08");
				}
				else if(!(tv_pein_disease_date3.getText().toString().length()>0)){
					tv_pein_disease_date3.setText("08");
				}
				else if(!(tv_pein_disease_date4.getText().toString().length()>0)){
					tv_pein_disease_date4.setText("08");
				}
				else if(!(tv_pein_disease_date5.getText().toString().length()>0)){
					tv_pein_disease_date5.setText("08");
				}
				else if(!(tv_pein_disease_date6.getText().toString().length()>0)){
					tv_pein_disease_date6.setText("08");
				}   
			}
			else {
				k--;
				if(tv_pein_disease_date1.getText().toString()=="08"){
					tv_pein_disease_date1.setText("");
					et_pein_disease_year1.setText("");
					et_pein_disease_month1.setText("");
				}
				else if(tv_pein_disease_date2.getText().toString()=="08"){
					tv_pein_disease_date2.setText("");
					et_pein_disease_year2.setText("");
					et_pein_disease_month2.setText("");
				}
				else if(tv_pein_disease_date3.getText().toString()=="08"){
					tv_pein_disease_date3.setText("");
					et_pein_disease_year3.setText("");
					et_pein_disease_month3.setText("");
				}
				else if(tv_pein_disease_date4.getText().toString()=="08"){
					tv_pein_disease_date4.setText("");
					et_pein_disease_year4.setText("");
					et_pein_disease_month4.setText("");
				}
				else if(tv_pein_disease_date5.getText().toString()=="08"){
					tv_pein_disease_date5.setText("");
					et_pein_disease_year5.setText("");
					et_pein_disease_month5.setText("");
				}
				else if(tv_pein_disease_date6.getText().toString()=="08"){
					tv_pein_disease_date6.setText("");
					et_pein_disease_year6.setText("");
					et_pein_disease_month6.setText("");
				}	
			}
			if(k>6){
				Toast.makeText(getContext(), "您最多可选六项",Toast.LENGTH_SHORT).show();
				cb_pein_disease_mental.setChecked(false);
				k--;
			}
/*			for(int j=0;j<tv_pein_disease_date.length;j++){
				if(!tv_pein_disease_date[j].isEnabled()){
					tv_pein_disease_date[j].setText("08");
				}
				break;
			}*/
		}
		else if(v==cb_pein_disease_tuberculosis){
			cb_pein_disease_none.setChecked(false);
			if(cb_pein_disease_tuberculosis.isChecked()){
				k++;
				if(!(tv_pein_disease_date1.getText().toString().length()>0)){
					tv_pein_disease_date1.setText("09");	
				}
				else if(!(tv_pein_disease_date2.getText().toString().length()>0)){
					tv_pein_disease_date2.setText("09");
				}
				else if(!(tv_pein_disease_date3.getText().toString().length()>0)){
					tv_pein_disease_date3.setText("09");
				}
				else if(!(tv_pein_disease_date4.getText().toString().length()>0)){
					tv_pein_disease_date4.setText("09");
				}
				else if(!(tv_pein_disease_date5.getText().toString().length()>0)){
					tv_pein_disease_date5.setText("09");
				}
				else if(!(tv_pein_disease_date6.getText().toString().length()>0)){
					tv_pein_disease_date6.setText("09");
				}   
			}
			else {
				k--;
				if(tv_pein_disease_date1.getText().toString()=="09"){
					tv_pein_disease_date1.setText("");
					et_pein_disease_year1.setText("");
					et_pein_disease_month1.setText("");
				}
				else if(tv_pein_disease_date2.getText().toString()=="09"){
					tv_pein_disease_date2.setText("");
					et_pein_disease_year2.setText("");
					et_pein_disease_month2.setText("");
				}
				else if(tv_pein_disease_date3.getText().toString()=="09"){
					tv_pein_disease_date3.setText("");
					et_pein_disease_year3.setText("");
					et_pein_disease_month3.setText("");
				}
				else if(tv_pein_disease_date4.getText().toString()=="09"){
					tv_pein_disease_date4.setText("");
					et_pein_disease_year4.setText("");
					et_pein_disease_month4.setText("");
				}
				else if(tv_pein_disease_date5.getText().toString()=="09"){
					tv_pein_disease_date5.setText("");
					et_pein_disease_year5.setText("");
					et_pein_disease_month5.setText("");
				}
				else if(tv_pein_disease_date6.getText().toString()=="09"){
					tv_pein_disease_date6.setText("");
					et_pein_disease_year6.setText("");
					et_pein_disease_month6.setText("");
				}	
			}
			if(k>6){
				Toast.makeText(getContext(), "您最多可选六项",Toast.LENGTH_SHORT).show();
				cb_pein_disease_tuberculosis.setChecked(false);
				k--;
			}
	/*		for(int j=0;j<tv_pein_disease_date.length;j++){
				if(!tv_pein_disease_date[j].isEnabled()){
					tv_pein_disease_date[j].setText("09");
				}
				break;
			}*/
		}
		else if(v==cb_pein_disease_hepatitis){
			cb_pein_disease_none.setChecked(false);
			if(cb_pein_disease_hepatitis.isChecked()){
				k++;
				if(!(tv_pein_disease_date1.getText().toString().length()>0)){
					tv_pein_disease_date1.setText("10");	
				}
				else if(!(tv_pein_disease_date2.getText().toString().length()>0)){
					tv_pein_disease_date2.setText("10");
				}
				else if(!(tv_pein_disease_date3.getText().toString().length()>0)){
					tv_pein_disease_date3.setText("10");
				}
				else if(!(tv_pein_disease_date4.getText().toString().length()>0)){
					tv_pein_disease_date4.setText("10");
				}
				else if(!(tv_pein_disease_date5.getText().toString().length()>0)){
					tv_pein_disease_date5.setText("10");
				}
				else if(!(tv_pein_disease_date6.getText().toString().length()>0)){
					tv_pein_disease_date6.setText("10");
				}   
			}
			else {
				k--;
				if(tv_pein_disease_date1.getText().toString()=="10"){
					tv_pein_disease_date1.setText("");
					et_pein_disease_year1.setText("");
					et_pein_disease_month1.setText("");
				}
				else if(tv_pein_disease_date2.getText().toString()=="10"){
					tv_pein_disease_date2.setText("");
					et_pein_disease_year2.setText("");
					et_pein_disease_month2.setText("");
				}
				else if(tv_pein_disease_date3.getText().toString()=="10"){
					tv_pein_disease_date3.setText("");
					et_pein_disease_year3.setText("");
					et_pein_disease_month3.setText("");
				}
				else if(tv_pein_disease_date4.getText().toString()=="10"){
					tv_pein_disease_date4.setText("");
					et_pein_disease_year4.setText("");
					et_pein_disease_month4.setText("");
				}
				else if(tv_pein_disease_date5.getText().toString()=="10"){
					tv_pein_disease_date5.setText("");
					et_pein_disease_year5.setText("");
					et_pein_disease_month5.setText("");
				}
				else if(tv_pein_disease_date6.getText().toString()=="10"){
					tv_pein_disease_date6.setText("");
					et_pein_disease_year6.setText("");
					et_pein_disease_month6.setText("");
				}	
			}
			if(k>6){
				Toast.makeText(getContext(), "您最多可选六项",Toast.LENGTH_SHORT).show();
				cb_pein_disease_hepatitis.setChecked(false);
				k--;
			}
		/*	for(int j=0;j<tv_pein_disease_date.length;j++){
				if(!tv_pein_disease_date[j].isEnabled()){
					tv_pein_disease_date[j].setText("10");
				}
				break;
			}*/
		}
		else if(v==cb_pein_disease_othercontagion){
			cb_pein_disease_none.setChecked(false);
			if(cb_pein_disease_othercontagion.isChecked()){
				k++;
				if(!(tv_pein_disease_date1.getText().toString().length()>0)){
					tv_pein_disease_date1.setText("11");	
				}
				else if(!(tv_pein_disease_date2.getText().toString().length()>0)){
					tv_pein_disease_date2.setText("11");
				}
				else if(!(tv_pein_disease_date3.getText().toString().length()>0)){
					tv_pein_disease_date3.setText("11");
				}
				else if(!(tv_pein_disease_date4.getText().toString().length()>0)){
					tv_pein_disease_date4.setText("11");
				}
				else if(!(tv_pein_disease_date5.getText().toString().length()>0)){
					tv_pein_disease_date5.setText("11");
				}
				else if(!(tv_pein_disease_date6.getText().toString().length()>0)){
					tv_pein_disease_date6.setText("11");
				}   
			}
			else {
				k--;
				if(tv_pein_disease_date1.getText().toString()=="11"){
					tv_pein_disease_date1.setText("");
					et_pein_disease_year1.setText("");
					et_pein_disease_month1.setText("");
				}
				else if(tv_pein_disease_date2.getText().toString()=="11"){
					tv_pein_disease_date2.setText("");
					et_pein_disease_year2.setText("");
					et_pein_disease_month2.setText("");
				}
				else if(tv_pein_disease_date3.getText().toString()=="11"){
					tv_pein_disease_date3.setText("");
					et_pein_disease_year3.setText("");
					et_pein_disease_month3.setText("");
				}
				else if(tv_pein_disease_date4.getText().toString()=="11"){
					tv_pein_disease_date4.setText("");
					et_pein_disease_year4.setText("");
					et_pein_disease_month4.setText("");
				}
				else if(tv_pein_disease_date5.getText().toString()=="11"){
					tv_pein_disease_date5.setText("");
					et_pein_disease_year5.setText("");
					et_pein_disease_month5.setText("");
				}
				else if(tv_pein_disease_date6.getText().toString()=="11"){
					tv_pein_disease_date6.setText("");
					et_pein_disease_year6.setText("");
					et_pein_disease_month6.setText("");
				}	
			}
			if(k>6){
				Toast.makeText(getContext(), "您最多可选六项",Toast.LENGTH_SHORT).show();
				cb_pein_disease_othercontagion.setChecked(false);
				k--;
			}
		/*	for(int j=0;j<tv_pein_disease_date.length;j++){
				if(!tv_pein_disease_date[j].isEnabled()){
					tv_pein_disease_date[j].setText("11");
				}
				break;
			}*/
		}
		else if(v==cb_pein_disease_occ){
			cb_pein_disease_none.setChecked(false);
			if(cb_pein_disease_occ.isChecked()){
				k++;
				et_pein_disease_occ.requestFocus();
				et_pein_disease_occ.setEnabled(true);
				if(!(tv_pein_disease_date1.getText().toString().length()>0)){
					tv_pein_disease_date1.setText("12");	
				}
				else if(!(tv_pein_disease_date2.getText().toString().length()>0)){
					tv_pein_disease_date2.setText("12");
				}
				else if(!(tv_pein_disease_date3.getText().toString().length()>0)){
					tv_pein_disease_date3.setText("12");
				}
				else if(!(tv_pein_disease_date4.getText().toString().length()>0)){
					tv_pein_disease_date4.setText("12");
				}
				else if(!(tv_pein_disease_date5.getText().toString().length()>0)){
					tv_pein_disease_date5.setText("12");
				}
				else if(!(tv_pein_disease_date6.getText().toString().length()>0)){
					tv_pein_disease_date6.setText("12");
				}   
			}
			else {
				k--;
				et_pein_disease_occ.setEnabled(false);
				et_pein_disease_occ.setText("");
				if(tv_pein_disease_date1.getText().toString()=="12"){
					tv_pein_disease_date1.setText("");
					et_pein_disease_year1.setText("");
					et_pein_disease_month1.setText("");
				}
				else if(tv_pein_disease_date2.getText().toString()=="12"){
					tv_pein_disease_date2.setText("");
					et_pein_disease_year2.setText("");
					et_pein_disease_month2.setText("");
				}
				else if(tv_pein_disease_date3.getText().toString()=="12"){
					tv_pein_disease_date3.setText("");
					et_pein_disease_year3.setText("");
					et_pein_disease_month3.setText("");
				}
				else if(tv_pein_disease_date4.getText().toString()=="12"){
					tv_pein_disease_date4.setText("");
					et_pein_disease_year4.setText("");
					et_pein_disease_month4.setText("");
				}
				else if(tv_pein_disease_date5.getText().toString()=="12"){
					tv_pein_disease_date5.setText("");
					et_pein_disease_year5.setText("");
					et_pein_disease_month5.setText("");
				}
				else if(tv_pein_disease_date6.getText().toString()=="12"){
					tv_pein_disease_date6.setText("");
					et_pein_disease_year6.setText("");
					et_pein_disease_month6.setText("");
				}	
			}
			if(k>6){
				Toast.makeText(getContext(), "您最多可选六项",Toast.LENGTH_SHORT).show();
				cb_pein_disease_occ.setChecked(false);
				k--;
			}
	/*		for(int j=0;j<tv_pein_disease_date.length;j++){
				if(!tv_pein_disease_date[j].isEnabled()){
					tv_pein_disease_date[j].setText("12");
				}
				break;
			}*/
		}
		else if(v==cb_pein_disease_other){
			cb_pein_disease_none.setChecked(false);
			if(cb_pein_disease_other.isChecked()){
				k++;
				et_pein_disease_other.requestFocus();
				et_pein_disease_other.setEnabled(true);
				if(!(tv_pein_disease_date1.getText().toString().length()>0)){
					tv_pein_disease_date1.setText("13");	
				}
				else if(!(tv_pein_disease_date2.getText().toString().length()>0)){
					tv_pein_disease_date2.setText("13");
				}
				else if(!(tv_pein_disease_date3.getText().toString().length()>0)){
					tv_pein_disease_date3.setText("13");
				}
				else if(!(tv_pein_disease_date4.getText().toString().length()>0)){
					tv_pein_disease_date4.setText("13");
				}
				else if(!(tv_pein_disease_date5.getText().toString().length()>0)){
					tv_pein_disease_date5.setText("13");
				}
				else if(!(tv_pein_disease_date6.getText().toString().length()>0)){
					tv_pein_disease_date6.setText("13");
				}   
			}
			else {
				k--;
				et_pein_disease_other.setEnabled(false);
				et_pein_disease_other.setText("");
				if(tv_pein_disease_date1.getText().toString()=="13"){
					tv_pein_disease_date1.setText("");
					et_pein_disease_year1.setText("");
					et_pein_disease_month1.setText("");
				}
				else if(tv_pein_disease_date2.getText().toString()=="13"){
					tv_pein_disease_date2.setText("");
					et_pein_disease_year2.setText("");
					et_pein_disease_month2.setText("");
				}
				else if(tv_pein_disease_date3.getText().toString()=="13"){
					tv_pein_disease_date3.setText("");
					et_pein_disease_year3.setText("");
					et_pein_disease_month3.setText("");
				}
				else if(tv_pein_disease_date4.getText().toString()=="13"){
					tv_pein_disease_date4.setText("");
					et_pein_disease_year4.setText("");
					et_pein_disease_month4.setText("");
				}
				else if(tv_pein_disease_date5.getText().toString()=="13"){
					tv_pein_disease_date5.setText("");
					et_pein_disease_year5.setText("");
					et_pein_disease_month5.setText("");
				}
				else if(tv_pein_disease_date6.getText().toString()=="13"){
					tv_pein_disease_date6.setText("");
					et_pein_disease_year6.setText("");
					et_pein_disease_month6.setText("");
				}	
			}
			if(k>6){
				Toast.makeText(getContext(), "您最多可选六项",Toast.LENGTH_SHORT).show();
				cb_pein_disease_other.setChecked(false);
				k--;
			}
	/*		for(int j=0;j<tv_pein_disease_date.length;j++){
				if(!tv_pein_disease_date[j].isEnabled()){
					tv_pein_disease_date[j].setText("13");
				}
				break;
			}*/
		}
		else if(v==rb_pein_nonesurgery){
			if(rb_pein_nonesurgery.isChecked()){
				et_pein_surgery_name1.setEnabled(false);
				et_pein_surgery_time1.setEnabled(false);
				et_pein_surgery_name2.setEnabled(false);
				et_pein_surgery_time2.setEnabled(false);
				et_pein_surgery_name1.setText("");
				et_pein_surgery_time1.setText("");
				et_pein_surgery_name2.setText("");
				et_pein_surgery_time2.setText("");
			}else{
				et_pein_surgery_name1.setEnabled(true);
				et_pein_surgery_time1.setEnabled(true);
				et_pein_surgery_name2.setEnabled(true);
				et_pein_surgery_time2.setEnabled(true);
			}
		}
		else if(v==rb_pein_surgery){
			et_pein_surgery_name1.requestFocus();
			et_pein_surgery_name1.setEnabled(true);
			et_pein_surgery_time1.setEnabled(true);
			et_pein_surgery_name2.setEnabled(true);
			et_pein_surgery_time2.setEnabled(true);
		}
		else if(v==rb_pein_nonetrauma){
			if(rb_pein_nonetrauma.isChecked()){
				et_pein_trauma_name1.setEnabled(false);
				et_pein_trauma_time1.setEnabled(false);
				et_pein_trauma_name2.setEnabled(false);
				et_pein_trauma_time2.setEnabled(false);
				et_pein_trauma_name1.setText("");
				et_pein_trauma_time1.setText("");
				et_pein_trauma_name2.setText("");
				et_pein_trauma_time2.setText("");
			}
		}
		else if(v==rb_pein_trauma){
			if(rb_pein_trauma.isChecked()){
				et_pein_trauma_name1.requestFocus();
				et_pein_trauma_name1.setEnabled(true);
				et_pein_trauma_time1.setEnabled(true);
				et_pein_trauma_name2.setEnabled(true);
				et_pein_trauma_time2.setEnabled(true);
			}
		}
		else if(v==rb_pein_nonetransfusion){
			if(rb_pein_nonetransfusion.isChecked()){
				et_pein_transfusion_reason1.setEnabled(false);
				et_pein_transfusion_time1.setEnabled(false);
				et_pein_transfusion_reason2.setEnabled(false);
				et_pein_transfusion_time2.setEnabled(false);
				et_pein_transfusion_reason1.setText("");
				et_pein_transfusion_time1.setText("");
				et_pein_transfusion_reason2.setText("");
				et_pein_transfusion_time2.setText("");
			}
		}
		else if(v==rb_pein_transfusion_reason){
			et_pein_transfusion_reason1.requestFocus();
			et_pein_transfusion_reason1.setEnabled(true);
			et_pein_transfusion_time1.setEnabled(true);
			et_pein_transfusion_reason2.setEnabled(true);
			et_pein_transfusion_time2.setEnabled(true);
		}
		else if(v==et_pein_surgery_time1){
			mPopupWindow = new MyPopupWindow(myContext);			
			mPopupWindow.showAtLocation(v.findViewById(R.id.et_pein_surgery_time1), Gravity.CENTER, 0, 0);

			Button btn=mPopupWindow.getButton();
			btn.setOnClickListener(new OnClickListener(){

				@Override
				public void onClick(View v) {
					// TODO Auto-generated method stub
					et_pein_surgery_time1.setText(mPopupWindow.getDate());
					mPopupWindow.dismiss();
				}
				
			});
		}
		else if(v==et_pein_surgery_time2){
			mPopupWindow = new MyPopupWindow(myContext);			
			mPopupWindow.showAtLocation(v.findViewById(R.id.et_pein_surgery_time2), Gravity.CENTER, 0, 0);

			Button btn=mPopupWindow.getButton();
			btn.setOnClickListener(new OnClickListener(){

				@Override
				public void onClick(View v) {
					// TODO Auto-generated method stub
					et_pein_surgery_time2.setText(mPopupWindow.getDate());
					mPopupWindow.dismiss();
				}
				
			});
		}
		else if(v==et_pein_trauma_time1){
			mPopupWindow = new MyPopupWindow(myContext);			
			mPopupWindow.showAtLocation(v.findViewById(R.id.et_pein_trauma_time1), Gravity.CENTER, 0, 0);

			Button btn=mPopupWindow.getButton();
			btn.setOnClickListener(new OnClickListener(){

				@Override
				public void onClick(View v) {
					// TODO Auto-generated method stub
					et_pein_trauma_time1.setText(mPopupWindow.getDate());
					mPopupWindow.dismiss();
				}
				
			});
		}
		else if(v==et_pein_trauma_time2){
			mPopupWindow = new MyPopupWindow(myContext);			
			mPopupWindow.showAtLocation(v.findViewById(R.id.et_pein_trauma_time2), Gravity.CENTER, 0, 0);

			Button btn=mPopupWindow.getButton();
			btn.setOnClickListener(new OnClickListener(){

				@Override
				public void onClick(View v) {
					// TODO Auto-generated method stub
					et_pein_trauma_time2.setText(mPopupWindow.getDate());
					mPopupWindow.dismiss();
				}
				
			});
		}
		else if(v==et_pein_transfusion_time1){
			mPopupWindow = new MyPopupWindow(myContext);			
			mPopupWindow.showAtLocation(v.findViewById(R.id.et_pein_transfusion_time1), Gravity.CENTER, 0, 0);

			Button btn=mPopupWindow.getButton();
			btn.setOnClickListener(new OnClickListener(){

				@Override
				public void onClick(View v) {
					// TODO Auto-generated method stub
					et_pein_transfusion_time1.setText(mPopupWindow.getDate());
					mPopupWindow.dismiss();
				}
				
			});
		}
		else if(v==et_pein_transfusion_time2){
			mPopupWindow = new MyPopupWindow(myContext);			
			mPopupWindow.showAtLocation(v.findViewById(R.id.et_pein_transfusion_time2), Gravity.CENTER, 0, 0);

			Button btn=mPopupWindow.getButton();
			btn.setOnClickListener(new OnClickListener(){

				@Override
				public void onClick(View v) {
					// TODO Auto-generated method stub
					et_pein_transfusion_time2.setText(mPopupWindow.getDate());
					mPopupWindow.dismiss();
				}
				
			});
		}
/*		else if(v==et_pein_disease_year1){
			mPopupWindow = new MyPopupWindow(myContext);			
			mPopupWindow.showAtLocation(v.findViewById(R.id.et_pein_disease_year1), Gravity.CENTER, 0, 0);

			Button btn=mPopupWindow.getButton();
			btn.setOnClickListener(new OnClickListener(){

				@Override
				public void onClick(View v) {
					// TODO Auto-generated method stub
					et_pein_disease_year1.setText(mPopupWindow.getYear());
					mPopupWindow.dismiss();
				}
				
			});
		}*/
    }
    /**
     * 系统自带的日期选择控件，因为自定义的需要3.0以上的版本
     * ！！仅当前测试使用！！
     * @param vdate 日期选择的触发控件
     */
    private void showDateDialog(EditText v) {
		// TODO Auto-generated method stub
    	Calendar cal = Calendar.getInstance();
    	int def_year = cal.get(Calendar.YEAR);
    	int def_month = cal.get(Calendar.MONTH);
    	int def_day = cal.get(Calendar.DAY_OF_MONTH);
    	final EditText vdate = v;
    	
    	new DatePickerDialog(myContext, 
    			new DatePickerDialog.OnDateSetListener() {
					
					@Override
					public void onDateSet(DatePicker view, int year, int monthOfYear,
							int dayOfMonth) {
						// TODO Auto-generated method stub
				    	Calendar c = Calendar.getInstance();
						c.set(Calendar.YEAR, year);
						c.set(Calendar.MONTH, monthOfYear);
						c.set(Calendar.DAY_OF_MONTH, dayOfMonth);
						SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd");
						vdate.setText(sf.format(c.getTime()));
						System.out.println(vdate.getText().toString());
					}
				}, 
				def_year, def_month, def_day)//点击日期控件时默认显示当前日期
    	.show();
		
	}

	//修改个人基本信息表（Page1）
    public void modifyPersonInfo1(){
		saveView();
		selectData();
		initView();
	//	profileid=ht.getHeti_profileid();
		PersonInfoLog pil=new PersonInfoLog(myContext);
		PersonInfo pisv=new PersonInfo(myContext);
		pisv.selectPersonInfo(profileid);
		Calendar c =Calendar.getInstance();
		String time=String.valueOf(c.getTimeInMillis());
	//	String year=Integer.toString(c.get(Calendar.YEAR));
	//	String month=Integer.toString(c.get(Calendar.MONTH));
	//	String day=Integer.toString(c.get(Calendar.DAY_OF_MONTH));
	//	String time=year+"-"+month+"-"+day;
		if(pi.getPein_sex()!=pisv.getPein_sex()){
		//	pein.setPein_sex(pisv.getPein_sex());
			pil.setPilo_column_value(PEIN_SEX);
			pil.setPilo_previous_value(Integer.toString(pi.getPein_sex()));
			pil.setPilo_current_value(Integer.toString(pisv.getPein_sex()));
			pil.setPilo_timestamp(time);
			pil.setPilo_profile_id(profileid);
			pil.insertPersonInfoLog();
		}
		if(pi.getPein_born().toString()!=pisv.getPein_born().toString()){
			pil.setPilo_column_value(PEIN_BORN);
			pil.setPilo_previous_value(pi.getPein_born());
			pil.setPilo_current_value(pisv.getPein_born());
			pil.setPilo_timestamp(time);
			pil.setPilo_profile_id(profileid);
			pil.insertPersonInfoLog();
		}
		if(pi.getPein_phone().toString()!=pisv.getPein_phone().toString()){
			pil.setPilo_column_value(PEIN_PHONE);
			pil.setPilo_previous_value(pi.getPein_phone());
			pil.setPilo_current_value(pisv.getPein_phone());
			pil.setPilo_timestamp(time);
			pil.setPilo_profile_id(profileid);
			pil.insertPersonInfoLog();
		}
		if(pi.getPein_contact_name().toString()!=pisv.getPein_contact_name().toString()){
			pil.setPilo_column_value(PEIN_CONTACT_NAME);
			pil.setPilo_previous_value(pi.getPein_contact_name());
			pil.setPilo_current_value(pisv.getPein_contact_name());
			pil.setPilo_timestamp(time);
			pil.setPilo_profile_id(profileid);
			pil.insertPersonInfoLog();
		}
		if(pi.getPein_contact_phone().toString()!=pisv.getPein_contact_phone().toString()){
			pil.setPilo_column_value(PEIN_CONTACT_PHONE);
			pil.setPilo_previous_value(pi.getPein_contact_phone());
			pil.setPilo_current_value(pisv.getPein_contact_phone());
			pil.setPilo_timestamp(time);
			pil.setPilo_profile_id(profileid);
			pil.insertPersonInfoLog();
		}
		if(pi.getPein_permatent_type()!=pisv.getPein_permatent_type()){
			pil.setPilo_column_value(PEIN_PERMATENT_TYPE);
			pil.setPilo_previous_value(Integer.toString(pi.getPein_permatent_type()));
			pil.setPilo_current_value(Integer.toString(pisv.getPein_permatent_type()));
			pil.setPilo_timestamp(time);
			pil.setPilo_profile_id(profileid);
			pil.insertPersonInfoLog();
		}
		if(pi.getPein_nation()!=pisv.getPein_nation()){
			pil.setPilo_column_value(PEIN_NATION);
			pil.setPilo_previous_value(Integer.toString(pi.getPein_nation()));
			pil.setPilo_current_value(Integer.toString(pisv.getPein_nation()));
			pil.setPilo_timestamp(time);
			pil.setPilo_profile_id(profileid);
			pil.insertPersonInfoLog();
		}
		if(pi.getPein_minority().toString()!=pisv.getPein_minority().toString()){
			pil.setPilo_column_value(PEIN_MINORITY);
			pil.setPilo_previous_value(pi.getPein_minority());
			pil.setPilo_current_value(pisv.getPein_minority());
			pil.setPilo_timestamp(time);
			pil.setPilo_profile_id(profileid);
			pil.insertPersonInfoLog();
		}
		if(pi.getPein_blood_type()!=pisv.getPein_blood_type()){
			pil.setPilo_column_value(PEIN_BLOOD_TYPE);
			pil.setPilo_previous_value(Integer.toString(pi.getPein_blood_type()));
			pil.setPilo_current_value(Integer.toString(pisv.getPein_blood_type()));
			pil.setPilo_timestamp(time);
			pil.setPilo_profile_id(profileid);
			pil.insertPersonInfoLog();
		}
		if(pi.getPein_rh_negative()!=pisv.getPein_rh_negative()){
			pil.setPilo_column_value(PEIN_RH_NEGATIVE);
			pil.setPilo_previous_value(Integer.toString(pi.getPein_rh_negative()));
			pil.setPilo_current_value(Integer.toString(pisv.getPein_rh_negative()));
			pil.setPilo_timestamp(time);
			pil.setPilo_profile_id(profileid);
			pil.insertPersonInfoLog();
		}
		if(pi.getPein_culture_stdd()!=pisv.getPein_culture_stdd()){
			pil.setPilo_column_value(PEIN_CULTURE_STDD);
			pil.setPilo_previous_value(Integer.toString(pi.getPein_culture_stdd()));
			pil.setPilo_current_value(Integer.toString(pisv.getPein_culture_stdd()));
			pil.setPilo_timestamp(time);
			pil.setPilo_profile_id(profileid);
			pil.insertPersonInfoLog();
		}
		if(pi.getPein_occupation()!=pisv.getPein_occupation()){
			pil.setPilo_column_value(PEIN_OCCUPATION);
			pil.setPilo_previous_value(Integer.toString(pi.getPein_occupation()));
			pil.setPilo_current_value(Integer.toString(pisv.getPein_occupation()));
			pil.setPilo_timestamp(time);
			pil.setPilo_profile_id(profileid);
			pil.insertPersonInfoLog();
		}
		if(pi.getPein_marriage()!=pisv.getPein_marriage()){
			pil.setPilo_column_value(PEIN_MARRIAGE);
			pil.setPilo_previous_value(Integer.toString(pi.getPein_marriage()));
			pil.setPilo_current_value(Integer.toString(pisv.getPein_marriage()));
			pil.setPilo_timestamp(time);
			pil.setPilo_profile_id(profileid);
			pil.insertPersonInfoLog();
		}
		if(pi.getPein_hos_cost_type().toString()!=pi.getPein_hos_cost_type().toString()){
			pil.setPilo_column_value(PEIN_HOS_COST_TYPE);
			pil.setPilo_previous_value(pi.getPein_hos_cost_type());
			pil.setPilo_current_value(pisv.getPein_hos_cost_type());
			pil.setPilo_timestamp(time);
			pil.setPilo_profile_id(profileid);
			pil.insertPersonInfoLog();
		}
		if(pi.getPein_hos_cost_type_ot().toString()!=pisv.getPein_hos_cost_type_ot().toString()){
			pil.setPilo_column_value(PEIN_HOS_COST_TYPE_OT);
			pil.setPilo_previous_value(pi.getPein_hos_cost_type_ot());
			pil.setPilo_current_value(pisv.getPein_hos_cost_type_ot());
			pil.setPilo_timestamp(time);
			pil.setPilo_profile_id(profileid);
			pil.insertPersonInfoLog();
		}
		if(pi.getPein_drug_allergy().toString()!=pisv.getPein_drug_allergy().toString()){
			pil.setPilo_column_value(PEIN_DRUG_ALLERGY);
			pil.setPilo_previous_value(pi.getPein_drug_allergy());
			pil.setPilo_current_value(pisv.getPein_drug_allergy());
			pil.setPilo_timestamp(time);
			pil.setPilo_profile_id(profileid);
			pil.insertPersonInfoLog();
		}
		if(pi.getPein_drug_allergy_ot().toString()!=pisv.getPein_drug_allergy().toString()){
			pil.setPilo_column_value(PEIN_DRUG_ALLERGY_OT);
			pil.setPilo_previous_value(pi.getPein_drug_allergy_ot());
			pil.setPilo_current_value(pisv.getPein_drug_allergy_ot());
			pil.setPilo_timestamp(time);
			pil.setPilo_profile_id(profileid);
			pil.insertPersonInfoLog();
		}
		if(pi.getPein_exposure_his().toString()!=pisv.getPein_exposure_his().toString()){
			pil.setPilo_column_value(PEIN_EXPOSURE_HIS);
			pil.setPilo_previous_value(pi.getPein_exposure_his());
			pil.setPilo_current_value(pisv.getPein_exposure_his());
			pil.setPilo_timestamp(time);
			pil.setPilo_profile_id(profileid);
			pil.insertPersonInfoLog();
		}
		if(pi.getPein_disease().toString()!=pisv.getPein_disease().toString()){
			pil.setPilo_column_value(PEIN_DISEASE);
			pil.setPilo_previous_value(pi.getPein_disease());
			pil.setPilo_current_value(pisv.getPein_disease());
			pil.setPilo_timestamp(time);
			pil.setPilo_profile_id(profileid);
			pil.insertPersonInfoLog();
		}
		if(pi.getPein_disease_ot().toString()!=pisv.getPein_disease_ot().toString()){
			pil.setPilo_column_value(PEIN_DISEASE_OT);
			pil.setPilo_previous_value(pi.getPein_disease_ot());
			pil.setPilo_current_value(pisv.getPein_disease_ot());
			pil.setPilo_timestamp(time);
			pil.setPilo_profile_id(profileid);
			pil.insertPersonInfoLog();
		}
		if(pi.getPein_disease_date().toString()!=pisv.getPein_disease_date().toString()){
			pil.setPilo_column_value(PEIN_DISEASE_DATE);
			pil.setPilo_previous_value(pi.getPein_disease_date());
			pil.setPilo_current_value(pisv.getPein_disease_date());
			pil.setPilo_timestamp(time);
			pil.setPilo_profile_id(profileid);
			pil.insertPersonInfoLog();
		}
		
    }
   
}